Solved

Upload temporary file name in PHP

Posted on 2008-06-17
5
747 Views
Last Modified: 2013-12-13
When I do an HTML upload, controlled by PHP, once it is complete I can get the temporary file name by looking at [tmp_name] => C:\Program Files\PHP\uploadtemp\php5A0D.tmp of $_FILES

I want to either be able to control the tmp_name or know what the name is before the upload is complete.
0
Comment
Question by:mpiaser
5 Comments
 
LVL 49

Expert Comment

by:Roonaan
Comment Utility
You can't. The php is only executed after the upload has been completed.
0
 
LVL 48

Expert Comment

by:hernst42
Comment Utility
The name of the file the user uploaded is stored in ['name']. You can also check the filename that should be uploaded with Javascript on the client side
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
Comment Utility
>> I want to either be able to control the tmp_name or know what the name is before the upload is complete.

I think, it might be stored on the server in the temporary folder where you have configured the tmp foldre, just get it with,

$_FILES["file"]["tmp_name"] - the name of the temporary copy of the file stored on the server

print the name using $_FILES["file"]["tmp_name"]

and see this available on you temp dir

ref. http://www.tizag.com/phpT/fileupload.php
0
 

Author Comment

by:mpiaser
Comment Utility
it is there but it is not populated until AFTER the upload has been completed.  I have found a way to code around this situation by looking in the temp directory before launching the upload and then looking again one the upload starts - by comparing the two I know which file(s) were created (that is the temporary file containing the upload data).  It isn't a perfect approach as the code can get mixed up if two uploads are started at the same time...but it is better than any alternative I've been able to come up with.

Might as well close this question.
0
 

Accepted Solution

by:
mpiaser earned 0 total points
Comment Utility
How do I get this question closed?  I solved this issue myself.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now