NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Nick on April 09, 2014, 04:07:44 PM
-
With this html I upload a file to the (NT7) webserver:
<form id="myid" enctype="multipart/form-data" method="post" action="#">
<input id="fileupload" name="myfile" type="file" />
<input type="submit" value="submit" id="submit" />
</form>
I see it in the log-post-window of the webserver. Filename, content-length, all is there:
POST /_CONTACT HTTP/1.1
Host: localhost
Connection: keep-alive
Content-Length: 63382
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://localhost
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MLSROX1S3Hs9fiY
Referer: http://localhost/_CONTACT
Accept-Encoding: gzip,deflate,sdch
Accept-Language: nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: SESSIONID=582481416
------WebKitFormBoundary7MLSROX1S3Hs9fiY
Content-Disposition: form-data; name="myfile"; filename="NetTalk.htm"
Question: where/how can I get to this in the webhandler.
Tried a few things in the handlefile and GetContent but no luck.
Which var's hold the filename and content?
TIA,
Nick
-
Have it working by using Self.SaveFile('myfile')
The manual says that this is the default working of the server so then why do I have to use this method?
Nick
-
Files are not saved in WebHandler, as they were in NT6. They are saved by the form itself. So ideally you want a NetWebForm procedure called _Contact, with a File Upload field on it called myfile.
cheers
Bruce
-
Thanks, yes I know but this is a special app that doesn't use the templates and so works different.
Is there some method that I can use to see if the file upload is completed?
Cheers,
Nick
-
I'm not sure I understand the question. Complete _where_ ? Into the WebServer?
Into the WebHandler?
cheers
Bruce
-
Well, I mean the moment when the uploaded file has been saved to disk.
That's what I mean by completed.
I use the .SafeFile() method in the Webhandler.
I guess this is working async. so it may be hard to tell when the file is completely saved on disk (?)
Cheers,
Nick
-
Would the exists() function do well here?
Cheers,
Nick
-
oh, no, not at all. SaveFile is "sync". The whole file has arrived by the time you are in the webHandler and are calling Save. So if you want to add code after SaveFile then just do it there.
cheers
Bruce