I did not manage to upload files to my database. Does anyone have any idea. What happens is that the database responds "Unsupported media type" It is a common SQL database, so it should not be that tricky.
This is the html form:
<form action="api/upload" method="POST" enctype="multipart/form-data">
<input type="text" name="k" value="88C9607F-4A89-447D-97C4-BC124DDA7DBF” />
</form>
And this is what I try to do:
local tData,tPic
constant gUid = "88C9607F-4A89-447D-97C4-BC124DDA7DBF" -- just for test
on mouseUp
set the vis of the templateImage to false
mobilePickPhoto "library"
put the last image into tPic
put buildIt() into tData
post tData to URL myUrl
answer it-- just for test
set the httpHeaders to empty
end mouseUp
function buildIt
put "Content-Disposition: form-data; name=" & K & crlf after tData
put "Content-Disposition: form-data; value=" & gUid & crlf after tData
put tPic & crlf after tData
put "Content-Type: multipart/form-data; boundary=" into theHeader
set the httpHeaders to theHeader
return tData
end buildIt
What am I doing wrong?
/// Peter
I can not upload file using CGI
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 136
- Joined: Fri Oct 14, 2011 6:53 am
I can not upload file using CGI
/*Whats all the fuss with c# ?*/
Re: I can not upload file using CGI
Hi Peter,
quick guess: Do K and gUID not need to be on QUOTES?
...
put "Content-Disposition: form-data; name=" & QUOTE & K & QUOTE & crlf after tData
put "Content-Disposition: form-data; value=" & QUOTE & gUid & QUOTE & crlf after tData
...
?
Best
Klaus
quick guess: Do K and gUID not need to be on QUOTES?
...
put "Content-Disposition: form-data; name=" & QUOTE & K & QUOTE & crlf after tData
put "Content-Disposition: form-data; value=" & QUOTE & gUid & QUOTE & crlf after tData
...
?
Best
Klaus
-
- Posts: 136
- Joined: Fri Oct 14, 2011 6:53 am
Re: I can not upload file using CGI
Hi Klaus,
I've tried it, but it did not work so I removed them.
The only difference is that the database responds "One or more error occurred" or "Unsupported media type"
I'm stuck!
///Peter
I've tried it, but it did not work so I removed them.
The only difference is that the database responds "One or more error occurred" or "Unsupported media type"
I'm stuck!
///Peter
/*Whats all the fuss with c# ?*/