Sarah
|
| Posted: 02/28/2002, 8:28 AM |
|
I've created a page (UploadResult), and I have an upload form that's action= UploadResult. On UploadResult I define a variable ($document_link) which is simply a link to the file I just uploaded. The script then redirects to the same page it came from(AdminDocumentRecord). What I need to do is after I upload, and am redirected, have a field on AdminDocumentRecord that is called document_link, filled in with the variable $document_link.
Here is what I have in the open event of the UploadResult page
//user defined variables
$abpath = "/home/morris/public_html/document"; //Absolute path to where images are uploaded. No trailing slash
$sizelim = "no"; //Do you want size limit, yes or no
$size = "2500000"; //What do you want size limited to be if there is one
//all image types to upload
$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type
$cert4 = "image/ief"; //Ief type
$cert5 = "image/png"; //Png type
$cert6 = "image/tiff"; //Tiff type
$cert7 = "image/bmp"; //Bmp Type
$cert8 = "image/vnd.wap.wbmp"; //Wbmp type
$cert9 = "image/x-cmu-raster"; //Ras type
$cert10 = "image/x-x-portable-anymap"; //Pnm type
$cert11 = "image/x-portable-bitmap"; //Pbm type
$cert12 = "image/x-portable-graymap"; //Pgm type
$cert13 = "image/x-portable-pixmap"; //Ppm type
$cert14 = "image/x-rgb"; //Rgb type
$cert15 = "image/x-xbitmap"; //Xbm type
$cert16 = "image/x-xpixmap"; //Xpm type
$cert17 = "image/x-xwindowdump"; //Xwd type
$log = "";
//begin upload 1
//checks if file exists
if ($img1_name == "") {
$log .= "No file selected for upload 1<br>";
}
if ($img1_name != "") {
//checks if file exists
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img1_size > $size) {
$log .= "File 1 was too big<br>";
}
}
//Checks if file is an image
if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3) or ($img1_type == $cert4) or ($img1_type == $cert5) or ($img1_type == $cert6) or ($img1_type == $cert7) or ($img1_type == $cert8) or ($img1_type == $cert9) or ($img1_type == $cert10) or ($img1_type == $cert11) or ($img1_type == $cert12) or ($img1_type == $cert13) or ($img1_type == $cert14) or ($img1_type == $cert15) or ($img1_type == $cert16) or ($img1_type == $cert17)) {
@copy($img1, "$abpath/$img1_name") or $log .= "Couldn't copy image 1 to server<br>";
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 was uploaded<br>";
}
} else {
$log .= "File 1 is not an image<br>";
}
}
}
$document_link ="$abpath/$img1_name";
// Redirect the user to the AdminDocumentGrid.php page
header("Location: AdminDocumentGrid.php");
Does anyone know how I can accomplish this? My goal here is to allow a user to go to the AdminDocumentRecord page and upload an image then be shown a link to that image, along with some empty feilds that they can fill in, like document_number and so on, and then add the record to the database. Any help would be greatly appreciated
|
|
|
 |
Sarah
|
| Posted: 02/28/2002, 2:09 PM |
|
I got an answer on another forum. What I did was simply add header("Location: AdminDocumentRecord.php?document_link=$document_link"); to the bottom of the UploadResult page. And IT WORKED YEAH!!!!
|
|
|
 |
|