View Full Version : use flash as an interface to upload files
I want to have a user import files from their desktop to be displayed in a scrollbar,
-I found a great tutorial on gotoandlearn for a scroll bar
-I figured out how to use loader to place any file I want or take it off a url.
-can I create an interface for users to upload their own pics to it?
-any sugestions?
Medyman
09-11-2008, 11:18 PM
Sure...
It's done all the time. Of course, the Flash would just provide the UI. You'll need to have something else (like PHP) doing the heavy lifting.
http://labs.findsubstance.com/2008/04/03/as3-upload-encode-images/
http://drawlogic.com/2007/08/02/uploading-multiple-selectable-files-with-flash9-and-as3/
Be aware of recent security changes (http://theflashblog.com/?p=423) to the Flash Player when implementing an upload form
g_force
09-15-2008, 11:32 AM
Nice links Medyman - I've been searching for this info for a while/
The first I just downloaded and put it straight onto my server to see if it worked but nothing went into the directories so I'm not sure if the server side is correctly set up - lack of knowledge here but I know that was mentioned - though I did notice a php file in there which doesn't appear to be referenced. I only created directories on my server and referenced these variables in 'Image Creator.as' as advised. Real shame 'cos it looks unreal.
The second I tried to test it in the same way (putting it straight on the server) having created a simple html page with the flash (.swf file in) but it wouldn't show even though they are all in the same directory on the server.
Anyone got any advice on any of these two?? Particularly the first which seems to require a server side script (don't know how to implement it) and would possibly also benefit from the images appearing in proportion on screen.
Medyman
09-15-2008, 11:26 PM
What are you chmod permissions for the directories you're trying to upload images to? That would be where I would start.
g_force
09-20-2008, 12:55 PM
They are 777 - which allows them to be written to. Is this what you are asking for?
Medyman
09-23-2008, 10:53 PM
Yes, that's what I meant. But 777 should not cause any issues.
I'm not really sure what else could be the matter. I've never used the particular techniques outlined in those links so I can't offer much.
g_force
09-24-2008, 06:22 PM
Thanks anyway and if anyone can help on this subject please post for the interests of advancement.
Medyman
09-24-2008, 11:18 PM
Hey g_force...
Are you 100% positive about your server is set up correctly? I just downloaded the source (http://labs.findsubstance.com/d/as3-upload-encode-images/as3-upload-encode-images.zip) from the first link (http://labs.findsubstance.com/2008/04/03/as3-upload-encode-images/) I posted and it works perfectly fine.
You can see it here (http://www.visualbinary.net/files/tutorials/image-encode-upload). You can go to www.visualbinary.net/files/tutorials/image-encode-upload/uploads/your-file-name.jpg to see that your file does get uploaded.
All I did was take everything within the deploy directory and uploaded it to my server. I make sure that the uploads and output directories were writeable, and voila.
You mentioned going into Image Creator.as in your post. I haven't opened it, but you don't need to be messing with the source code (unless you want to change the functionality).
g_force
12-12-2008, 01:16 PM
thanks for the reply and sorry to take so long to respond...
I have done exactly as you say that you did - that is:
1) uploaded the deploy directory to my server
2) made the uploads and output directories writable
It doesn't show the image nor upload it to my server. When I test it in flash it seems to work but as only the .swf file was provided there is no way to open up the script and have a look. If yours worked and mine didn't there must be some slight difference in what we did - any idea what it could be?
-thanks
Medyman
12-12-2008, 07:03 PM
Since the code is the same, the differences would be on the server. Those might be hard to pin down, but some things I would check:
1) PHP uploads are enabled in php.ini
2) Files uploaded via PHP get the right permissions
3) Upload file limits
4) PHP memory limits
You might need to contact your host to figure out the correct settings.
g_force
12-15-2008, 09:27 AM
oh ok, yes it's all working now..
I do have one slight query though - How can I know who uploads what?
During the session the user inputs various pieces of information which are fed to a database, I would like also to feed the name of the uploaded file to the database - any idea how to do that?
Medyman
12-15-2008, 05:18 PM
With that particular script? No clue...
What I would suggest is to code a PHP example (just PHP, no Flash) that does this. And then add the Flash UI on top of it.
diltony
01-01-2009, 07:45 PM
I have a similar application i got in flex builder 3.0 [a flash software] - i have the source code and i actually used it online - though i had to write the php code for it, but i do not understand the entire source code to make modifications as such, i will post it shortly.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.