Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

upload image to webserver and load into movie

Status
Not open for further replies.

knuckle05

Programmer
Dec 17, 2001
247
CA
Hi All,

I notice that someone asked a similar question this morning, but mine is slightly different.

Would it be possible for a user to upload an image to the webserver, and then have their image (for ex, company logo) loaded into the Flash movie?

Then, would they be able to move this image around using the mouse?

I'm familiar with ActionScript, but it's been a while. Does anyone foresee any problems that I may run into trying to accomplish this? Thanks!
 
cant be done easily from flash

the problem with file uploads is that how you do it depends very much on what webserver software you are running, and on what OS. On windows with IIS for example, you cannot do file uploads without having to install extra software.
what happens ordinarily with an HTML page file upload, is that you have a special <form> tag attribute 'enctype'. When this is set to 'multipart/form-data' the server knows that it is about to receive a file.
On upload it stores it in a temporary location eg /var/tmp or c:\temp.
You also set the 'action' attribute to the name of a server-side script (eg php, asp) that can go to that temporary location, check what kind of file it is (VERY important as hackers can upload malicious files to your server) and manipulate it, e.g. move it to a permanent location, store it in a database etc, then delete the temporary copy.
and all thats if your server admin has allowed file uploads.....many switch it off to avoid malicious uploads.

assuming you get this far then you could have a button in flash call a javascript function

getURL(javascript: functionName(arguments));


i think also that are a couple of third party tools that can do the above for you but i dont have access to my links at the moment.

 
Thanks for your response.

Actually, I've accomplished the FileUpload on a couple of different projects, using 3rd party tools, and straight vbSCript, so this is the part I'm least worried about.

So assuming I'm able to get my file to the server, perform validation on it, and save it in the proper location, would I then be able to dynamically load it into my Flash movie and move it around?
 
Also...

I'm not really sure I see the need to call a JavaScript function. Couldn't the move operations be performed using ActionScript?
 
absolutely

you just have to know the folder its in

loadMovie(&quot;path/image.jpg&quot;,holder);

with holder an empty movie clip on stage


then AFTER its loaded (a simple preloader to check) you can move it around any way you want by targeting the clip (holder) that contains the image.

i have an example that might help


look at actionscript tween
 
no the javascript was to upload the image...nothing to do with manipulation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top