PDA

View Full Version : file upload to a server - check extension


texbala
01-16-2003, 07:35 PM
hi..
i have a question on file uploading to a server.

Is there any way of checking the extension (whether a doc or tex file) before uploading a file to a server. Bascially I need to upload only doc/ txt files. I don't want to upload it and then delete the file if the extension is different. Is this the only way?

also.. how is the security when a file is uploaded? how to check if the file contains a virus? If the webserver have a anti-virus software, will it check the file for virus before uploading?

I am using coldfusion MX and use <cffile action = upload> to upload files. If you know good tutorial websites for Coldfusion... pls. let me know.

advanced thnx!!

Philip Toews
01-17-2003, 12:15 AM
I don't mean to hijack your thread texbala...but I have a few related issues I thought I'd add for the flash gurus to ponder...

Texbala brings up key issues involved in file transfer...e.g virus checking, extension confirmation.

What about checking file size and connection speeds?

Are there open source tools out there to allow basic file transfer? Are there Flash components that anyone knows of that allow the same? In a similar thread I noticed that some actionscript.org members believe it is not possible to facilitate file transfer using Flash. Is this possible...something that Flash MX can't do??

Does anyone have a prototype hack, component or something similar to allow the joys of allowing users to submit files to the web server?

Unlike Texbala, I am using PHP. I am assuming that I have to do the "hard work" using the server side script (e.g. checking file size, file extensions, etc...) but how to get the basic file info to PHP is where I am stuck...

TIA oh great Flash ones...

:D

freddycodes
01-17-2003, 12:22 AM
You can't. As of yet there is no way to launch the browse for file dialog from flash. Y oucan possibly hack a way in IE where you have a javascript onLoad handler to launch the file dialog, but other than that you can't right now.

Philip Toews
01-17-2003, 01:55 AM
That's too bad. I assume it can be done in html using a standard form? I guess one would have to launch a standard browser window from Flash, do the file browse there and then reroute back to the flash page...passing variables to get you back to the appropriate part of the swf....

Are there any third party products that the great ones suggest to get this kind of thing done?

Oh...Freddy...being the PHP wizard that you are, how would you go about solving the file upload issues mentioned in the initial posts (e.g. virus check, file size confirmation, etc.)?

:cool:

CyanBlue
01-17-2003, 02:53 AM
Howdy... :)

I am not sure how much of this would be applicable to you, but this is little bit of what I did in my last project...

I had used JavaScript's window.open() function to call the PHP script that has form within it... By clicking on the 'Browse' button, I open the dialog which is used to select the file... (I am using the form inside of the HTML popup window, remember???)

Once 'Upload' button is pressed, I used
$tempsize = @$HTTP_POST_FILES['uploadedFile']['size'];
$temptype = @$HTTP_POST_FILES['uploadedFile']['type'];
to check the file size and the file mime type...

When upload is done, I used 1X1 SWF file that I embed after the upload to talk back to Flash that upload is done...

Basically this is what I did... I wish I could tell you more, but this is all I can say due to the contract that I have signed... I am not the PHP guru or Flash guru at all... Most of the stuff came from the searching this ActionScript.org and Were-Here.com... So... if what I just said applies to you, get yourself surfing...

Good luck...