Hamid
Hamid

Reputation: 827

send upload request to a redirect location

There are three pages page0, page1 and page2
Page0 sending upload_file_http_request to page1 by php fsockopen method, I don't want to upload file in page1 but just changing request header value and then redirect this upload_file_http_request to page2, then in page2 going to upload file (with new header values). how can I do that if it's possible?

page0 ---> send file from client to page1 (create upload-file-request)

page1 <--- receive upload-file-request

page1 ---- change header values of upload-file-request WITHOUT uploading file

page1 ---> redirect above request to page2

page2 <--- uploading file to server

Upvotes: 0

Views: 2347

Answers (1)

Brad
Brad

Reputation: 163232

You want a form on "page0" to attempt an upload to "page1", and then "page1" redirects to "page2" where the client will actually upload the file?

No, this isn't possible.

Your PHP script isn't even loaded until the initial file upload is done on page1. Then if you do a redirect, the client will not upload at the new page.

You must find some other way. You could for example just upload to page2 in the first place. If the URL of page2 is dynamic, you could use AJAX to get that URL from your server prior to submit.

Upvotes: 1

Related Questions