I am getting extremely frustrated with the WebFileUploader control. I am at my wits end. I have a simple form where users fill out a few textfields, select a few items from popup buttons and select files to upload using the WebFileUploader control. When the user clicks “Submit” on the form it always sends it (via email) without fail, regardless of whether the user has selected files to upload or not. However, if the user has selected files to upload it is a 70/30 chance that it will actually upload the files. When it doesn’t upload the user gets no error and it appears as if everything works but the files never show up on the server. If the user clicks “Submit” again (the form is not cleared each time the user submits) then the files may or may not upload the second time. It’s a crap shoot.
I’ve tried running the application as a CGI and as a standalone. It’s the same either way. I’ve tried using the “file.Save” method and the "output = BinaryStream.Create(outputFile, True) method. Same results.
I’m at a loss. The customer is starting to get annoyed and is suggesting I find another dev platform which I don’t want to do.
Here is the code within the UploadComplete section where this takes place:
Dim outputFile As FolderItem
Dim output As BinaryStream
Dim r As New Random
Dim i As Integer
For Each file As WebUploadedFile In files
Try
if Lowercase(file.Name)=“image.jpg” then
i = r.InRange(0, 999999)
outputFile = New FolderItem(ReplaceAll("/JobImages/"+str(i)+""+txtJobNum.Text+""+file.Name," “,”"))
else
outputFile = New FolderItem(ReplaceAll("/JobImages/"+txtJobNum.Text+""+file.Name," “,”"))
end if
output = BinaryStream.Create(outputFile, True)
output.Write(file.Data)
output.Close
if Lowercase(file.Name)=“image.jpg” then
Session.FileList.Append(ReplaceAll(ImageServer + “/JobImages/” + str(i) + "" + txtJobNum.Text+""+file.Name," “,”"))
else
Session.FileList.Append(ReplaceAll(ImageServer + “/JobImages/” + txtJobNum.Text+""+file.Name," “,”"))
end if
Catch e As IOException
msgbox e.Message+" " + str(e.ErrorNumber)
Continue
Finally
End Try
Next
SendMail
As I’ve said, there are no errors and the files disappear from the FileIploader control as they should once the upload completes but they never show up on the server. As an extreme test I build another server and put the app on it. Same results.