Hello, I am trying to upload an image to a server using B4J but I have not been successful, when uploading it I get the following error:
java.io.FileNotFoundException: C:\Users\landr\AppData\Local\Temp\1 (El sistema no puede encontrar el archivo especificado)
On the server side there is a php file that accepts the file and saves it, this has worked for me for a long time but my ISP has changed my server and now the service does not work, initially we tested that everything on the server was fine so I made a simple HTML to upload the image, and indeed it uploads without problem using the same php file, I would appreciate it if you could help me with this error.
Also tryed with this code:
Also tryed with 'mp.ContentType = "multipart/form-data" but the same result
I attach the error image
Thank you in advance for your help!
java.io.FileNotFoundException: C:\Users\landr\AppData\Local\Temp\1 (El sistema no puede encontrar el archivo especificado)
On the server side there is a php file that accepts the file and saves it, this has worked for me for a long time but my ISP has changed my server and now the service does not work, initially we tested that everything on the server was fine so I made a simple HTML to upload the image, and indeed it uploads without problem using the same php file, I would appreciate it if you could help me with this error.
B4X:
Dim j As HttpJob
Dim m As Map
m.Initialize
m.Put("file","Null")
Dim files As List
files.Initialize
Dim fd1 As MultipartFileData
fd1.Initialize
fd1.KeyName = "File"
fd1.Dir = "c:\BizetDS\Imagenes\"
fd1.FileName = "111.jpg"
fd1.ContentType = "image/jpg"
files.Add(fd1)
j.Initialize("", Me)
j.PostMultipart("http://ServerIP/plesk-site-preview/seiton5s.com.mx/upload.php",m,files)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log(j.GetString)
xui.MsgboxAsync(j.GetString,"Envio de archivo")
Else
xui.MsgboxAsync(j.GetString,"Error al enviar el archivo")
End If
j.Release
B4X:
Dim lline As String
Dim lReader As TextReader
Dim j As HttpJob
Dim img As String = "111.jpg"
j.Initialize("", Me)
Dim mp As MultipartFileData
mp.Initialize
Dim imgruta As String = "c:\BizetDS\Imagenes\"
mp.Dir = imgruta
mp.FileName = img
mp.KeyName = "file"
mp.ContentType = "image/jpg"
j.PostMultipart("http://Serverip/plesk-site-preview/seiton5s.com.mx/upload.php", Null, Array(mp))
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log(j.GetString)
xui.MsgboxAsync(j.GetString,"Envio de archivo")
Else
xui.MsgboxAsync(j.GetString,"Error al enviar el archivo")
End If
j.Release
I attach the error image
Thank you in advance for your help!