Solved

Upload temporary file name in PHP

Posted on 2008-06-17
5
764 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 49

Expert Comment

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

Expert Comment

by:hernst42
ID: 21805236
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
ID: 21811951
>> 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
ID: 21811985
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
ID: 22777129
How do I get this question closed?  I solved this issue myself.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

687 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