Jump to content

Passing variables


alaiasis

Recommended Posts

Hello,

I'm very new to PHP (started this morning) and I need some help. thanks in advance...

I need to do three things.

1st - upload a file from the client's computer to a server
2nd - take the basename of the file and make it a variable
3d - redirect to a .asp page and pass the above mentioned variable along with it.

I have successfully completed the first task, but do not know how to do the next two tasks.

Here is what I have so far (note that the header function within the "if" statement is not working)


[!--coloro:#333399--][span style=\"color:#333399\"][!--/coloro--]<?php

$target_path = "images/";

$target_path = $target_path . basename( $_FILES['PicName']['name']);

$_FILES['PicName']['tmp_name'];
$target_path = "images/";

$target_path = $target_path . basename( $_FILES['PicName']['name']);

if(move_uploaded_file($_FILES['PicName']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['PicName']['name']). " has been uploaded";
header("Refresh: 6; updateclassified.asp?");
} else{
echo "There was an error uploading the file, please try again!";
}
?>[!--colorc--][/span][!--/colorc--]

Thanks again for any help you can give.
Link to comment
Share on other sites

The variable $_FILES['picname']['name'] is a variable.

YOu can pass it over with a url if you wanted by putting it in a url like
[code]
$var = $_FILES['picname']['name'];
header( "Location: file.asp?file=".$var );[/code]
Although i'm not too sure if asp would like it.
Link to comment
Share on other sites

Hi Guru,

Thanks for your reply (and sorry I haven't responded until now)...

When I run the code, the file uploads fine and I get the message that the file has uploaded, but I can't get the code to redirect to another page to work.

Any thoughts?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.