Image Upload HELP - Please!

Posted on 2003-03-06
Medium Priority
Last Modified: 2010-04-03

I am having a problem with uploading an image via flash and am hoping someone could lend their flash expertise.

I am developing a TEXT to HTML text editor and would like to have the ability to upload images as well. I am able to 'browse' and locate files, however I cannot attatch them and have the path display on the dynamic input text.

What I would like to have happen is this.

1) Click on the 'image' icon.
2) Dialog box is displayed with a 'browse' button
3) User selects desired file.
4) File is presented in dynamic text area
5) User clicks 'Done' and the text is carried over into the 'Editor' screen.

I located a tutorial which works by itself, however when I attempt to incorporate it into my image upload movie, it doesn't work... Here is the tutorial file.

If anyone out there could assist me with this I would be most appreciative.

P.S. - I am attathing the files which I am using for reference in hopes someone can look at and tell me what I am missng.

Thank you in advance!

You can access the fla, swf and html files here:

Question by:sukimaster
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8086471
hmmm ... i know what u are trying to do ...  i have done similar thing which allow user to upload their files etc thru flash (at leastlooks like it) ... using the file field in html.

but this thing does work with MAC, NN etc ...
anyway, i haven't open u code yet to see what exactly happen... just a guess ...

let me check in a while

Expert Comment

ID: 8087192
I tried it, and your example actually works as given with me, IE 6.1, WinXP Pro, so what are you using?

Expert Comment

ID: 8087612
this is what is wrong ...

setInterval("document.all['movie'].SetVariable('filename', filename);", 100);

<OBJECT ......
 WIDTH="100%" HEIGHT="100%" id="my_editor2" ALIGN="">

in the javascript u have the movie name call
document.all['movie'] ....

and the object tag for IE u have id="my_editor2"

that's why u can't get the variables in ur swf ...

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 8087622
just a note ...

<object> tag is for IE
<embed tag is for NN

when u do a document.all['ID NAME HERE']
it is the id from the object tag which the browser look for not the <param> tag

LVL 22

Expert Comment

ID: 8088550
just a comment on this subject...

Do you really need to return the long path to the file in your document?  I have developed this type of application as well and chose not to display the path at all...  

It is quite ugly to see the path in a text box anyway, and the user will not care one bit if they can see the path.  I think this issue comes up too often, and developers need to ask why they are every doing it.

Unless it is imparitive to make the application work, which I doubt, you should just simplify everything.

just have button that says "upload image" in the first frame, and have it take them to the next frame after the javascript.  The second frame should have a sutton that says "submit".  It simplifies the process, and gets rid of any user confusion, and the ugly long path to the file...

just my opinion on the subject... take it for what it is worth.


Author Comment

ID: 8088672
Thank you all for your responses. However, I still cannot get this to work. It's been a while since I've used flash and am basically piecing together this project and learning quite alot in the process.

After changing the following from

setInterval("document.all['movie'].SetVariable('filename', filename)", 100);


setInterval("document.all['my_editor2'].SetVariable('filename', filename)", 100);

it is still not uploading or showing the path.

rascalpants  -  In regards to your most recent question, I agree that it's not imperitive that it be shown in the text area. I would like to see you example or if you wouldn't mind, possibly incorporating it into my code. It's completely open source...

It is necessary however to, once the file is selected in the 'browse' path, to pass it into the 'Editor' screen. This way the user can preview it then if he or she decides they like it I'll export it and the file upload is executed. Otherwise the file is just referenced and displayed by using the path provided on their desktop.

If anyone could incorporate this function and then give it back to me I'd certainly appreciate it. I can then see how exactly you did it. Been battling with this problem for 4 days and can't take it anymore!! :)

Thanks again for all of your questions and assistance.



Expert Comment

ID: 8088765
oh .. sorry ...
i forgot ..

i changed one more thing ...
the text box in ur movie
it should set the variable to /:filename

since u are sending the filename to the swf (root)

cheers :)

Author Comment

ID: 8088805
I'd also consider even a simple HTML popup which allows the user to specify the file there and then when complete, the variable is transfered to the 'Editor' screen.

Again, these were issues I was unable to accomplish so if any knows how I could update my fla file to include the HTML window var I would be so happy! :)


Author Comment

ID: 8088839
henryww - could you email me the adjustments you made? webman@pumpkincutter.com

I'll then give you the accepted answer as I couldn't get it to work using the references you specified.


Accepted Solution

henryww earned 800 total points
ID: 8088892
it works fine, i have change ur fla, so to point textbox to /:filename and make multiline off ...

i agree with rp and that's how i did it in my project too ...

here's the code what u can do to chop the filename off ... i hope i am giving u an "elegant" solution !!!

    function check()
      setInterval("filename=document.all['ieinput'].value", 100);
      setInterval("chopFilename();", 100);
    if (ie4) setTimeout("check()", 500);
     function chopFilename() {
          if (filename == "") return true;
          sidx = filename.lastIndexOf("\\");
          filename = filename.substring(sidx+1,filename.length);
          document.all['movie'].SetVariable('filename', filename);

so u call a function in call chopFilename if there is a filename and return only the filename with no path.

the file is on it's way ...


Expert Comment

ID: 8088946

in fact i did a similar project which allows ppl to upload file and ... this similar method, it doesn't work with all browsers all platform ... not for macs ... so i decide to keep the nicely masked method for IE & PC and have a popup for mac ... that's how it ended up :)


Author Comment

ID: 8089613
This works! Thank you all! I only have a problem with the z-index and preview option now but I think that henryww and rp are taking a look at it.

I've updated the zip file with the current status for your review and suggestions/input.

Thanks again guys!~! :)

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month12 days, 22 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question