Solved

Upload temporary file name in PHP

Posted on 2008-06-17
5
761 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP Web Development 6 67
Difference between PHPClasse.php and SimplXLS.php 5 45
Echo'd value as selected in dropdown 20 42
PHP MYSQLI Connection in Function in a class 4 28
These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

732 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