Android Question Upload file Internal Server Error

ttsolution

Member
Licensed User
Longtime User
Dear All,

I used below code to upload picture to WebServer. I wonder why I could sucess upload which a picture but failed which another one. All my picture are jpg format and <1mb. I used httpUtils2

The error message is Internal Server Error

Many thanks for any help

Jonh

Below is part my code

Dim HttpClient1 As HttpJob 'HttpClient
Sub UploadPicture(P As Pic)
mFileName=P.CustomerId & ".jpg"

If File.Exists(File.DirDefaultExternal,mFileName)=True Then
If Msgbox2("Are you sure ?","","OK Upload","","Không",Null)=DialogResponse.POSITIVE Then
IsUploading=True
ProgressDialogShow("Uploading...please wait" & CRLF & P.CustomerName)
HttpClient1.Initialize("HttpClient1",Me)
HttpClient1.PostFile("http://mmis.vn/uploadform.asp?FileName=" & P.CustomerId,File.DirDefaultExternal,mFileName)
End If
Else
ToastMessageShow("Không tìm thấy file " & mFileName,False)
End If
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success=True Then
LoadPictureFiles
Else
Msgbox("Upload failed" & CRLF & Job.ErrorMessage,"")
End If
ProgressDialogHide
IsUploading=False
lblProgress.Text="Tab here to upload"
End Sub
 

sorex

Expert
Licensed User
Longtime User
can you upload the file via a web based form on a computer?

asp has a weakness and that's just file uploads.
 
Upvote 0

ttsolution

Member
Licensed User
Longtime User
When trying to upload files over 200KB on IIS 6 the file may never upload and you either get an error or are sent to a blank screen. By default Windows 2003 server limits file uploads to about 200KB in size. To overcome this limit you must edit the IIS metabase.xml file.

  1. Before you can edit the metabase.xml file you must tell IIS to allow you to edit the file. In IIS, right click the name of the server and select properties. Check "Enable Direct Metabase Edit"
  2. Find the metabase.xml file located in C:\windows\sytem32\inetserv and open the file in Notepad.
  3. Search for AspMaxRequestEntityAllowed and increase the value. The default value is 204800 (200K). Setting the value to 1000000 will allow 1 MB file uploads.
  4. You may now wish to uncheck the IIS property called "Enable Direct Metabase Edit".

To increase the file download size limit, repeat all steps above but in Step 3 find the parameter called AspBufferingLimit. The default download limit is 4MB.

Regards,

Jonh
 
Upvote 0
Top