tags:

views:

80

answers:

3

Is it possible to get temporary filename with javascript?

I want upload a file using ajax... So, i want to get the tmp filename with js. Is this possible?

A: 

If your using AJAX in combination with your server side language just return the temporary name and pull it in with the AJAX, if can all be done in 1 call.

Unkwntech
i tried to get it using php..but we are not submitting our form na?that is why the $_File is null..
If your upload is working then PHP will have some name for the file in $_FILES['uploadedfile']['tmp_name'] if you don't have anything in the $_FILES var then something is wrong with the upload process.
Unkwntech
A: 

i tried to get it using php.. but we are not submitting our form na? that is why the $_File is null.

Are you storing the file in your server with the temp name?
rahul
+1  A: 

AJAX itself won't let you upload a file via a web form - you need to perform a traditional form post to a window (or a frame/iframe) in order to send binary content. Such a post must be handled by your server code (in Java, PHP, python, etc), which can process the stream into a temporary file (some languages/frameworks such as PHP can do this automatically).

You can then make the temporary file available via a URL scheme, and return this URL back as the result page of the post. If this is all on the same domain as your main page, you can then use Javascript to look "inside" the result iframe to find the temporary URL.

levik
actually i didnt understand your ans.. I am not much expert with that.Are you telling about copy function?