justjosh Posted July 9, 2003 Posted July 9, 2003 Couple of questions: 1) Is there a good site that can help me create an asp.net page to upload files to an FTP server 2) I need to be able to have somebody upload an image to me, then will want to convert it to jpg, and resize the image. Any sites you could direct me to for this? 3) K, last but not least, I have a search that pulls data from an SQL Query and sticks the results in a datagrid. I have set the code to change the page to be: Private Sub MyDataGrid_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles MyDataGrid.PageIndexChanged MyDataGrid.CurrentPageIndex = e.NewPageIndex MyDataGrid.DataBind() End Sub When I click "next page" it clears the datagrid, and when I click on the "search" button again it will show the next page. One last thing, I have two radio buttons on another page that I want it to swap some text when I switch the two. But it has no effect when I switch the radio buttons. Here is the code: Private Sub Radio2_Radio_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio2_Radio.CheckedChanged TestA_Checkbox.Visible = True TestB_Checkbox.Text = "Some new text" End Sub I am using Visual Studio .Net 2003, with VB.NET Source. any help would be GREATLY appreciated Quote
WebJumper Posted July 9, 2003 Posted July 9, 2003 First I answer point 2, the rest maybe tomorrow (it is 00:20 and I must work tomorrow...) and I'm C# programmer, but cast it to VB should not too hard... For HTTP-Upload your form must have this attributes: <form id="Form1" method="post" encType="multipart/form-data" runat="server"> Consider that you can only upload 4MB data. If you want upload more data you have to change the machine.config in the framework's directory on your hdd! The InputFileField must look like this (and it must inside the form-tags) <INPUT id="File1" type="file" name="File1" runat="server"> That's all for the HTML part... go on to serverside... 1. Upload File string FileNameOnServer = @"C:\" + File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.LastIndexOf(@"\")+1); File1.PostedFile.SaveAs(FileNameOnServer); 2. Create Bitmap System.Drawing.Image sourceImg = System.Drawing.Image.FromFile(FileNameOnServer); System.Drawing.Bitmap destinationImg = new System.Drawing.Bitmap(sourceImg, new System.Drawing.Size(400, 200)); destinationImg.Save(@"C:\Test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); sourceImg.Dispose(); destinationImg.Dispose(); Good luck to convert to VB! Regards, Stefan Quote
WebJumper Posted July 9, 2003 Posted July 9, 2003 DataGrid problem: seems that your DataSource get lost. By clicking Search-Button i think you execute the SQL Query und set DataGrid.DataSource = myDataTable; or something... Hold the search results (DataTable) in a session and when the page do a postback acollate it to the datasource of the grid. Then the paging should work! RadioButtons: AutoPostBack must set to TRUE !!!! FTP problem: I'm sure anotherone helps you gladly! Greeetz! -WebJumper Quote
hrabia Posted July 10, 2003 Posted July 10, 2003 Hi WebJumper. When uploading and convertig file to bitmap you don't have to save your file on server, because this file "comes" as a stream. Than you can create a bitmap directly from that stream (one of the overloaded constructors). Quote A man and a dog have an average of three legs. Beaware of Statistics.
justjosh Posted July 21, 2003 Author Posted July 21, 2003 Thank you very much for your help, I havnt gotten to the point of testing ftp/image part, but the paging and radio buttons are working now, thanks! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.