Abisha
Abisha

Reputation:

Temporary file name with js

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?

Upvotes: 0

Views: 2322

Answers (2)

levik
levik

Reputation: 117499

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.

Upvotes: 1

UnkwnTech
UnkwnTech

Reputation: 90841

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.

Upvotes: 0

Related Questions