Am I correct in assuming the file is not being uploaded?
Well, file uploads typically don't include path/file names. I don't work
with Coldfusion but I can give you an example with PHP...
When you upload a file, you specify in your browser the file name and
path where it's found on your local machine (browse). When you hit
upload, the data is bundled together and sent to the server using the
POST method. The server receives a number of metadata items including
the file's original name, size, creation date, and temporary location
(where the web server received it).
Simply passing a file name to the script on the server won't do it. The
server has no access to your local drive (at least we hope not!) so what
can it do with that info? It's up to your client (IE/Netscape/etc.) to
send this data to the server. The server is passive in this exchange.
The reason Flash can't do file uploads is because, even if you can
browse local files somehow, it has no way of reading them into memory,
wrapping them in the correct content-type tags, and handing them over to
the server. This is especially true for Flash movies running on the web
because for security reasons they are explicitly forbidden from
accessing the client machine's hard drive.
Currently, only a stand-alone client like IE, Netscape, FTP
applications, etc. are capable of performing this type of operation.
Hope that clears it up :)
Regards,
Patrick
-----------------------------------------------------
www.baynewmedia.com IRC (
www.dal.net) -> #baynewmedia
-----------------------------------------------------
[quoted text, click to view] chrism59 wrote:
>Can you explain?
>
> After the user select a file I have a complete path/name for the image. I use
>that path/name to display the image in flash.
>
> Why is that path/file not valid when passed to a cffile upload?
>
>
Hi,
You're still missing the most important part...PHP and Coldfusion
sit on the server. They do not upload the file, or take the file from
your computer. You computer must send the file to them!
What your movie is receiving is the name of the file on your
computer. To PHP and Coldfusion, which are sitting across the network on
an entirely different computer, this information is meaningless. Your
browser has the ability to send the file to the server, but Flash has no
way to do this. In fact, imagine how dangerous it would be if it could....
Without prompting from the user, Flash could go and grab the
contents of a file on your computer (or guess a file name and try to
grab that) and pass it to the server. The file could contain password
data, personal information, who knows what. Obviously, this is
*extremely* dangerous and therefore not allowed. That's why the file
upload functionality in your browser is so strictly controlled! You can
browse your computer for file names, but that's the extent of it.
Listen, there are quite a few very competent Flash developers out
there. Do you think no one has thought this might be a useful feature?
Unfortunately, there's also been a lot of brainpower that's gone into
preventing just this type of thing from happening simply because it's so
insecure.
Again, I'll say good luck but I wouldn't get my hopes up high!
-----------------------------------------------------
www.baynewmedia.com IRC (
www.dal.net) -> #baynewmedia
-----------------------------------------------------
[quoted text, click to view] chrism59 wrote:
>No, This only adds tot he confusion.
>
> I can open my movie in IE from the server.(web address above with test
>username and password)
>
> I can click the browse button in flash and select an image from my hard drive.
>I can then load the image into my web base flash movie based on the information
>returned by the user.
>
> If my web based flash movie can do that shouldn't I be able to pass the file
>information that the user selected from their hard drive to maybe... a
>filefield (hidden) on my webpage.
>
> Then call a method...say php (I know nothing of php) or coldfusion and have it
>upload the file from the hidden filefield.
>
> The action can take part outside of flash and yet be controlled by flash?
>
> I know I'm pushing the envelop here but there has to be a way.
>
> When the user pressed the browse button in flash java does click the browse
>button for a hidden filefield. When the user select the image to upload the
>file information IS being passed back to flash.
>
> image_mc .loadMovie(filefield)
>
> loads the image in the web based flash movie.
>
> THERE HAS TO BE A WAY TO USE THIS filefield to upload the file.
>
>
Why is it that everyone tell me this process is impossible and lay the
impossibility at the feet of a part that I have already completed and is
working.
Am I missing something????
Or is it we all, at times, have trouble thinking outside the box. I am
desperately seeking help or an explanation of why it won't work.
you stated flashMX generally (version 6 assumed) cant browse files through flash.
I'm using 2004 and it also has no browse functionality. I accomplish the browse
using javascript on a button called Browse
on (release){
getURL("javascript:call_browse();");
}
I have a frame page top bottom with the top set at 100% containing the flash
move and the bottom set at 0% the bottom page has a cf filefield and the
following javascript in the header
<script language="javascript">
function set_variable(value) {
parent.mainFrame.movie.SetVariable("uploadfile",value);
}
</script>
All javascript was based on a download created by Dennis Baldwin, it didn't
work in mx 2004.
The top page has the following javascript in the header:
<script language="javascript">
function call_browse(){
parent.bottomFrame.form.file.click();
parent.bottomFrame.form.file.focus();
}
</script>
This process allow the user to browse for a file and returns the complete
path to flash.
Now I have the path and name of the file for uplaoding...I have the server
location and name where I wnat the file placed...I can pass both of these to a
cfm page. I just can't get the fcm page to work.
Please
Can you explain?
After the user select a file I have a complete path/name for the image. I use
that path/name to display the image in flash.
Why is that path/file not valid when passed to a cffile upload?
No, This only adds tot he confusion.
I can open my movie in IE from the server.(web address above with test
username and password)
I can click the browse button in flash and select an image from my hard drive.
I can then load the image into my web base flash movie based on the information
returned by the user.
If my web based flash movie can do that shouldn't I be able to pass the file
information that the user selected from their hard drive to maybe... a
filefield (hidden) on my webpage.
Then call a method...say php (I know nothing of php) or coldfusion and have it
upload the file from the hidden filefield.
The action can take part outside of flash and yet be controlled by flash?
I know I'm pushing the envelop here but there has to be a way.
When the user pressed the browse button in flash java does click the browse
button for a hidden filefield. When the user select the image to upload the
file information IS being passed back to flash.
image_mc .loadMovie(filefield)
loads the image in the web based flash movie.
THERE HAS TO BE A WAY TO USE THIS filefield to upload the file.
Patrick,
IT WORKS!!!!!
I understand that I am really uploading the file using Coldfusion, but to the
user it looks like the flash application is doing it and the flash
functionality can still be brought into the process.
I have now successfully uploaded a file using flash as the user interface!!!!!
I still have a lot of questions but I can see the file I uploaded on my server
at the ISP.
The major problem right now is the upload button triggers the hidden for
submit. The progress bar at the bottom of the browse window moves half way
across and stops. It however does not change the fact THE FILE WAS UPLOADED!!!
When I get the rest of the bugs out I will make this available to all!!.
If anyone can start me in the right direction to fix the progress bar I would
be very grateful.
I have posted a working copy of the file upload code. Searc for Flash File
Upload
Thany you to all who helped. I and included a detailed Read me and there are
still issues that need to be addressed. You help is welcome
Don't see what you're looking for? Try a search.