File upload
BlitzMax Forums/BlitzMax Programming/File upload
| ||
Is there an easy (secure) way of using blitzmax to upload a file (a zip)? My FTP account only has one username and password which has access to the whole site, so I'd rather not use that, I do not have SSH access either. Is it possible to do this with a server side PHP script (I can do it from a HTML form, but would like to do it direct)? cheers! |
| ||
It is possible, and there should be a few examples here already as iv seen the thread a few times. This would constitute a rather large security vulnerability in your website if the code is not 100% secure. so be careful. Once you get your PHP done, and you have your app uploading, if your worried about security let us know, it can be easily tested safely. |
| ||
You can do an http POST from within you app, if you are worried about security then you may want to encrypt the file within your application and then have your php script decrypt it when it's fully uploaded. |
| ||
cheers Yavin, I might get back to you on that. :D Indie: Ahh, so that'd be like a telnet over a Tstream or something? I'm not too fussed about file security (the content is pretty harmless) |
| ||
http://blitzbasic.com/codearcs/codearcs.php?code=1579 just make sure you send the data as "Content-type: multipart/form-data" |
| ||
cheers, indie :D I've got that working for normal text fields, however I am unsure as to how I should pass the actual zip file as well... I've been looking at the commincations used for a file upload through a web browser and got this... -----------------------------7d7177c60b6c Content-Disposition: form-data; name="ud_NAME" aaa -----------------------------7d7177c60b6c Content-Disposition: form-data; name="uploadedfile"; filename="C:\Dev\Ninjah\Data\Packs\WOOP.zip" Content-Type: application/x-zip-compressed PK ;´Ø}üÎ.... (the zip file content) How should I read/write the zip file into the stream? A byte at a time, or is there a 'proper' way of doing it? ta! |
| ||
Raz, what you want is skn3[ac]'s "HTTP POST multipart/form-data" code. THttpSend and THttpInput. I can't seem to find them on the forums, though. Aha, found it: http://www.blitzbasic.com/codearcs/codearcs.php?code=1932 |
| ||
Raph! That's exactly what I was after and it works perfectly! :D I dunno what I was doing wrong, but it's nice to see I was on the right track. Thanks again |