473,461 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

POST $_FILES

Hi!

I am facing the following problem:
I have a PHP-script on page A that receives a file from an HTML-form. I
need to immediately forward this file to another page B.

On page A currently I forward the user (under certain circumstances) to
page B using

header ("location: page_b.php");

But unfortunately the file that was posted to page A is lost. Is there a
way to forward the file to page B so that I can use the superglobal
$_FILES variable on page B?

I tried a very bad hack with sessions:
On page A:
$_SESSION["files"] = $_FILES;
On page B:
$_FILES = $_SESSION["files"];

I didn't really expect this to work - unfortunately it does not because
the server deletes the temporary file immediately. Well, I could try
copying the temporary file to a different filename but I believe there
is a simpler way by just adding the file again to the header?

Any suggestions on this? Thanks in advance!
Mike
Mar 14 '07 #1
1 2562
Michael Rassinger <dj***********@gmx.atwrote in
news:d4**************************@news.inode.at:
Hi!
I didn't really expect this to work - unfortunately it does not
because the server deletes the temporary file immediately. Well, I
could try copying the temporary file to a different filename but I
believe there is a simpler way by just adding the file again to the
header?

Any suggestions on this? Thanks in advance!
Mike
As you suggested, I think the best way it to copy the file to a temp
directory, and pick up the file on your "b" page.

You don't want page_a having to re-upload/re-send the files to page_b
anyways - uploading a file more than once is pretty wasteful, in terms of
server resources and time.
Mar 14 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bob Bedford | last post by:
I'm passing the code from $_POST to $_GET. I've a page upload using $_FILES. when the page was in $_POST, it worked fine, but now, in $_GET, the $_FILES is empty. any idea ?
6
by: Shelly | last post by:
I have searched and have not gotten an understanding of $_FILES. I am trying to do an upload to a directory "tmpdir" on the server. I have a field defined as: File name: <input...
3
by: ziana | last post by:
Hi all, What is the disadvantages of using GET/POST/COOKIES in php? What's the different when i use global below included in each files?, i can pass all the parameter without $_POST etc. and...
0
by: Vinay Nagrik | last post by:
Hello Group members, I have access to server side php script which takes parameters from a form and processes the buffer and saves the file. However, I, as an implementor, do not have the...
0
by: Event Horizon | last post by:
Hi, I'm trying to add an simple upload applet to shopping cart script. My new applet form sends all needed post fields ( quantity, product, etc... ) but the "file" post field is hardcoded in...
6
by: recordlovelife | last post by:
I have a photo uploader for a client. It's a simple input file button. But they wanted to be able to add more than one picture. So, when the client clicks the "add another picture?" button, I...
2
by: daav31 | last post by:
Hello, I have the following code: $RecordID = $_POST; $LastModBy= $_POST; // These datetime vars live in globals.php $mySQLToday = $thisYear.'-'.$thisMonth.'-'.$thisDay; // prints...
5
by: NitinSawant | last post by:
Hello, I'm beginner to php (actually i'm java/jsp developer), What i'm trying to do is Accept parameters from the HTML file and write them to a newly created file using php, I wrote...
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.