network.upload Please Help

I created a web service using C# to allow file upload

the service is working perfectly tested with Fiddler4 tool https://www.telerik.com/download/fiddler

In Corona This is the code which is working! as print commands show … but file is not being copied to upload folder

local function uploadListener( event )

  if ( event.isError ) then

    print( “Network Error.” )

  else

    if ( event.phase == “began” ) then

       print( “Upload started” )

    elseif ( event.phase == “progress” ) then

       print( "Uploading… bytes transferred ", event.bytesTransferred )

    elseif ( event.phase == “ended” ) then

       print( “Upload ended…” )

       print( “Status:”, event.status )

       print( “Response:”, event.response )

    end

   end

end

local url ="http://localhost/corona/fileupload"

local method = “POST”

local params = {

   timeout = 60,

   progress = true,

   bodyType = “binary”

}

local filename = “image.jpg”

local baseDirectory = system.ResourceDirectory

local contentType = “multipart/form-data”–also tried image/jpeg also tried image/jpg

local headers = {}

–  headers[“Content-Type”]=“multipart/form-data”–also tried image/jpeg also tried image/jpg — no need for this line it is defined as contentType 

params.headers = headers

network.upload( url , method, uploadListener, params, filename, baseDirectory, contentType )

i’m not really sure what the problem is, i tried to run .NET in debug mode, when using fiddler to upload a file, in .NET Request.Files.Count gives one, but when running this code from Corona the returned value is 0

attached is the print command output

Rob Miracle did a tutorial on file uploads:

     https://coronalabs.com/blog/2014/02/25/tutorial-uploading-files-demystified/

and it seems like Corona can’t do multipart/form-data uploads, at least not through the standard network.upload function.

thanks man, i read that already … my problem is that everything is working … and the listener gives size of bytes transferred, but when it is successfully done, the file does not show where it is supposed to … (in the upload folder) 

You will probably have to put some debugging in your server script to make sure you’re getting what you expect.

Rob

Rob Miracle did a tutorial on file uploads:

     https://coronalabs.com/blog/2014/02/25/tutorial-uploading-files-demystified/

and it seems like Corona can’t do multipart/form-data uploads, at least not through the standard network.upload function.

thanks man, i read that already … my problem is that everything is working … and the listener gives size of bytes transferred, but when it is successfully done, the file does not show where it is supposed to … (in the upload folder) 

You will probably have to put some debugging in your server script to make sure you’re getting what you expect.

Rob