difficulty with upload destination

Hello,

I recently downloaded the sample php script made by gyphie (located at http://www.swfupload.org/forum/generaldiscussion/214) and replaced the upload.php page that came with the samples. Before doing so I had downloaded and been tampering with the sample files trying to get it to work, which resulted in multiple failures Sad. I can read this file much better than the original upload.php file because it is very well documented, but i still can't get it to save files in the upload directory. I don't know any PHP...all of my pages run on a Coldfusion 8 server and are all written in the .cfm extension. I don't know if this has anything to do with it, but any help/advise on what the problem might be would be greatly appreciated. I am willing to learn some PHP if necessary because I really want it to work. Please help me!!!

Ben

gyphie's picture

PHP not required

We use PHP because our hosting supports PHP. However, most of our projects are in ASP.Net/C#. The server language is not important.

You should be able to handle the file upload in ColdFusion just like you would for any ColdFusion upload.

Just remember that a SWFUpload upload is more like an AJAX request than a form post. Your upload.cfm should receive the file, save it (or process it however you want) and then return some content.

re:

Thank you for replying,

If you can find the time, I have more questions for you Smiling

1. When you say it is like an AJAX request instead of a form post, are you referring to the fact that the page doesn't need to reload when you request to upload the file? The main reason I initially wanted this uploader so badly is because my hosting company will always throw a pageload timeout error after 15 seconds and cancel the upload everytime I try to upload a large file using a regular upload form...My guess was that if I could find some sort of AJAX/Javascript type uploader that doesn't cause the page to reload that it would fix the problem. Am I correct in my assumption?

2. Which file is actually executing the code that uploads the file? Where can I find this code?

3. Say I upload a video, is the variable "filedata" the video that I uploaded?

gyphie's picture

...

1. It is like ajax in that the page does not submit nor reload. The upload is made by an asynchronous connection. But instead of being made by JavaScript it is made by Flash (call it AFAX if you want, except there isn't any X).

You will probably still have upload timeout problems. The upload follows the same HTTP rules that a browser follows.

2. The Upload is made by Flash (swfupload.swf). The upload_url setting tells Flash where to send the file (corresponds to the 'action' attribute of an HTML form)

3. filedata is the default name for the uploaded data (note: this is not the file's name, just the upload name). This is what your 'name' or 'id' attribute would be set to for a regular <input type="file" /> upload.

Ok, here is what I just

Ok, here is what I just tried..

1. in the index.php file, I Replaced:

upload_url: "../multiinstancedemo/upload.php"
with
upload_url: "../multiinstancedemo/upload.cfm"

2. I made an upload.cfm file in the same directory as the upload.php file that contains this code:

//get path to save the file

<cfset path1 = "#GetBaseTemplatePath()#">

<cfset path2 = "#GetDirectoryFromPath(path1)#">

//move the variable that contains the file where i want it on the server

<cffile
action = "move"
destination = "#path2#thenameofmyfile.jpg"
source = "#Filedata#">

It still does not work. Are there any errors in the way I wrote this?

ugh the server didn't print

ugh the server didn't print out my code Sad

Here it is again...I took away the special characters though so it wont dissapear..

//get path

cfset path1 = "#GetBaseTemplatePath()#"
cfset path2 = "#GetDirectoryFromPath(path1)#"

//move file

cffile
action = "move"
destination = "#path2#thenameofmyfile.jpg"
source = "#Filedata#"