uploading files to a server

Started by
1 comment, last by CProgrammer 15 years, 12 months ago
Hi, after massive googling it seems that it is impossible to edit files before they are uploaded in flash. Basically you have to upload them, redownload them, change them and then upload them. Why i this? I fail to see the security benefit. Am I missing something? -CProgrammer
Advertisement
Hello CProgrammer,

(Disclaimer: I don't really know much about this so maybe completely wrong)

I'm assuming you're are talking about a flash script that the user has just downloaded and its ability to upload (access) files on the local machine.

I would guess this comes from the restriction that flash action script is not allowed to access the local file system. In the case of uploading a user selected file to the server the flash script is not "really" accessing the local file system, rather it is asking the browser to upload a file to the server. Because the browser is uploading the file, the file's contents are not available to the flash script - As providing access to this file during upload would allow the script (limited) read access to the local file system.

Obviously once the file has been uploaded to the server it can be sent back into flash as a downloaded (non-local) file and you can do anything you want with it. In your case modifiy and upload the modified version.

As an aside, I've just seen an interesting proposal that flash should have an API for accessing user selected files (Local File Access API) however I can't see any sign this has been taken up.

If you want to avoid sending your local files on a round trip to the server then the one alternative I can think of is:

- Provide a signed Java applet that communicates with your flash component. Once your the applet's and certificate has been accepted it will have access to the local file system. Unfortunately using the applet the user can when no longer control local file access by selecting individual files, and is now at the mercy of the code within the applet and flash component.

Cheers,

Tom
Thanks Tom,

now I see where this is coming from. I suppose there really isnt much I can do about it, since I don't want users to require java to use te site.
Initially I wanted to do some preprocessing on images on the client side before uploading in order to take some load off the server. But with the whole round trip thing Im not sure theres much of a benefit to the server or the user. The user has to upload, dwnload and upload again which just seems slow and the server has to manage all of these transferes.

Thanks for the response though.

-CProgrammer

This topic is closed to new replies.

Advertisement