I need to differentiate image between 2 file upload control: FileUpload1 and FileUpload2. My current code works fine but it actually upload images from both FileUpload1 and FileUpload2. How do I specify the file from FileUpload1 and FileUpload2. Below is my current code: Dim hfc As HttpFileCollection = Request.Files Dim imagePath As String = FileUpload1.PostedFile.FileName Dim imagesize As String Dim imagename As String = Path.GetFileName(imagePath) Dim ext As String Dim contenttype As String = String.Empty Try For i As Integer = 0 To hfc.Count - 1 Dim hpf As HttpPostedFile = hfc(i) ext = Path.GetExtension(hpf.FileName) imagesize = hpf.ContentLength If hpf.ContentLength …

Member Avatar
Member Avatar
+0 forum 1

newbie here! I am working with a simple PHP form with few fields and few uploads. I want to use the Modal pop up form for this. Below codes are working fine. I was able to insert the fields into MYSQL successfully but I don't know how to add file upload of docs/images into a folder and insert the URL into MYSQL. Here are my codes: Calling the Modal Form -> <button class="btn btn-success btn-lg" data-toggle="modal" data-target="#modalForm"> Add </button> The MODAL FORM -> <div class="modal fade" id="modalForm" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <button type="button" …

Member Avatar
Member Avatar
+0 forum 5

hi i have followed a online tutorial to replace photo system on my site and all went well till i attempt to upload photo i get no file selected even if i have just gone on the page but after pressing submit i get a success message and the photo goes to the database and in th euploads folder but it doesnt show on the album page can someone check this out as ive been through tutorial twice and there are no comments about this problem my upload code is <form enctype="multipart/form-data" method="post"> <?php if (isset($_POST['upload'])) { $name = $_POST['name']; …

Member Avatar
Member Avatar
+0 forum 4

Hi All, I am trying get FROM Email address while uploading email. I have FileUpload control to update the any of documents from drive to application. I need to get FROM Email address when uploading email using FileUpload. Please let me know if have any code like above Scenario

Member Avatar
Member Avatar
+0 forum 1

Hi I am developing an image hosting website.I want images uploaded to go to another server , not the one where the script is hosted.For e.g i want images to be uploaded to http://i1.mysite.com instead of http://mysite.com/uploads Suppose i have this code to upload file to server <form action="http://mysite.com/upload" method="post" accept-charset="utf-8" enctype="multipart/form-data"> <input type="file" name="image" id="file_upload" /> <input type="submit" value="Upload" id="upload_submit" /> </form> Ofc i could always change the form action to `<form action="http://i1.mysite.com/upload" method="post" accept-charset="utf-8" enctype="multipart/form-data">` But I'd be redirected to `http:/i1.mysite.com/upload` after upload I am thinking that i could create a php that do ftp connection to the …

Member Avatar
Member Avatar
+0 forum 15

Hi, I have this fileupload control which saves excel file on my server, but somehow, if the excel file is larger than 4 mb it does not save the file, i used this code fileupload1.SaveAs can you please help me on why does this happen? Thanks

Member Avatar
Member Avatar
+0 forum 5

Hi, I have this fileupload in my program and I want to set it's extension to .xls only, Is it possible? If yes, how can I set it so it's file filter will only be .xls? Thanks

Member Avatar
Member Avatar
+0 forum 2

i use vb.net i trying to do a file upload, i want to image to save to image folder, however, the image don't know appear in the directory that i indicate if i click on "show all file", the image appear, but the image icon is blank or white like the image below show so i click on that image and click on "include it in the project" , however, it shouldnt be the case that i everytime upload an image, i need to redo that again **so how should i allow don't appear the white icon and to always …

Member Avatar
Member Avatar
+0 forum 4

Hi All! I got a problem with one of my files where I can't upload a file to my database. I want to save the path in the db but it gives me an error and says the "Filename cannot be empty". In my .html [CODE] Upload a profile picture(50px X 50px): <td><input type="file" name="file" value="Choose a file" id="file"/></td> [/CODE] And then I send it to my .php file via [ICODE]<form method="post" action="index.php" enctype="multipart/form-data">[/ICODE] In my php I test if it has an jpeg,png etc. extention [CODE] $image = $_FILES['file']['name']; $error = false; if($image){ $filename = stripslashes($_FILES['file']['name']); $lastpart = getLastExtention($filename); …

Member Avatar
Member Avatar
+0 forum 7

Hi guys, This one is a bit out of left field but someone somewhere must have tried this before. Does anyone out there know how to control the width of the filepath textbox in a fileupload control? I have a form with a comment textbox, a filetype dropdown and a fileupload control I want the comment textbox, the dropdown and the textbox part of the fileupload to all be the same width and line up together on my form but the width property of the fileupload control sets that of the whole control (Textbox and browse button) I tried setting …

Member Avatar
Member Avatar
+0 forum 3

Hi every one,pls am trying to copy the content of my fileupload unto an hidden text box so that users will not have to copy it manually,but it just copies the file name wit exception of the path.I need the path name but in IE9,firefox,opera all i get is the file name without file path pls somebody help. this is my code protected void Button1_Click(object sender, EventArgs e) { string filepath = FileUpload1.PostedFile.FileName; hiddentext.text = filepath; } have also tried this protected void Button1_Click(object sender, EventArgs e) { string s1 = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName); string s2 = string.Copy(s1); hiddentext.text = s2; } …

Member Avatar
Member Avatar
+0 forum 4

Hello all and thank you in advance. I am building a website (AP.NET 3.5 and C#) that I put a File Uploader on using the "FileUpload". I then created a Button that has the following code in it: String savePath = @"DESTINATION_PATH"; if (FileUpload1.HasFile) { String fileName = FileUpload1.FileName; savePath += fileName; FileUpload1.SaveAs(savePath); UploadStatusLabel.Text = "Your file was Uploaded"; } I set the DESTINATION_PATH to my Desktop to test it and it worked. Now, I want to direct the destination to my hosting account through GoDaddy. So, I first set the permissions on the folder on the server for (Read/Write). …

Member Avatar
Member Avatar
+0 forum 1

Hi, In our project, I wrote the below code to upload any file of size less than equal to 2MB, in my local XP system working fine, when i deployed to client server having config windows server 2003, i got request time error when size is more than nearly more than 1MB. My code is: FileStream objFileStream; BinaryReader objBinaryReader; Byte[] byAttach; string sFileName = "TempAttach\\" + FileUpload1.FileName.ToString(); FileUpload1.PostedFile.SaveAs(HttpContext.Current.Server.MapPath(sFileName)); objFileStream = new FileStream(HttpContext.Current.Server.MapPath(sFileName), FileMode.Open, FileAccess.Read); objBinaryReader = new BinaryReader(objFileStream); byAttach = objBinaryReader.ReadBytes((Int32)objFileStream.Length); objBinaryReader.Close(); objFileStream.Close(); FileInfo objFileInfo = new FileInfo(HttpContext.Current.Server.MapPath(sFileName)); if (objFileInfo.Exists) { File.Delete(HttpContext.Current.Server.MapPath(sFileName)); } Web.config: <httpRuntime maxRequestLength="102400" executionTimeout="10000"/> <sessionState timeout="110"/> Eventhough …

Member Avatar
Member Avatar
+0 forum 3

I use [CODE] FileUpload.Filename = lbl1.text.ToString(); FileUpload.SaveAs(Server.MapPath("~/Photo/AllPhotoes/" + FileUpload.FileName)); [/CODE] and i got Error: Property or indexer 'System.Web.UI.WebControls.FileUpload.FileName' cannot be assigned. it is read only. I want to save image with label name which is hidden. and it get new value each time. how can i change image name with label name. help me....

Member Avatar
Member Avatar
+0 forum 3

I have looked this up on internet and no answer yet!!! I have a paged with a loginView which has a button and a fileupload control in it. When I double click on the button to add some commands I can see that the program can see the button and even if i put something there it will run it. But then when I want to say : if (FileUpload1.HasFile) then do something, it says FileUpload1 does not exist?! But I have FileUpload1 in the same page that my button exist in my loginview (LoggedIn not Anonymous) any help is …

Member Avatar
Member Avatar
+0 forum 1

I use asp.net with c#.net... My Question is...... I put the fileUplod tool & button to the asp page..at the run time..I was select some file using file Upload & then refresh the page or click the button,fileUploder become empty...how i keep fileUploader value until page submit Please help me

Member Avatar
Member Avatar
+0 forum 1

The End.