13. januar 2002 - 02:39Der er
15 kommentarer og 1 løsning
kan ikke få upload til at virke på friserverplads?
Jeg tænkte på at måske det er fordi jeg skriver stien forkert jeg har denne linje fra et script hvordan skal stien til min mappe der hedder billeder skrives ind? $updir = \"/home/zachwhit/public_html/img\"; //absolute path to where files are uploaded, no trailing slash
<? $updir = \"/http://www.friserverplads.dk/rikif/billeder\"; //absolute path to where files are uploaded, no trailing slash $sizelim = \"yes\"; //do you want size limitations yes or no $size = \"500000\"; //if you want size limited how many bytes $certtype = \"no\"; //do you want certain type of file, no recommended $type = \"\"; //what type of file would you like
//error if no file is selected if ($file_name == \"\") { die(\"No file selected to upload\"); } //error if file exists if (file_exists(\"$updir/$file_name\")) { die(\"The file you are trying to upload already exists\"); } //error if file is to big if ($sizelim == \"yes\") { if ($file_size > $size) { die(\"The file you are trying to upload is too big.\"); } } //error if file isn\'t certain type if ($certtype == \"yes\") { if ($type != $file_type) { die(\"The file you are trying to upload is wrong type\"); } } @copy($file, \"$updir/$file_name\") or die(\"The file you are trying to upload couldn\'t be copied to the server\"); ?> <html> <head> <title>File Uploaded</title> </head> <body> <p> <h2>File Uploaded</h2> File Name: <? echo \"$file_name\"; ?><br> File Size: <? echo \"$file_size\"; ?><br> File Type: <? echo \"$file_type\"; ?> </p> </body> </html>
for at teste det kan du prøve at fjerne stien i $upload - så skulle den bare kopiere filen over i den samme folder som den php fil hvori scriptet bliver udført.
det vil stadig hjælpe med en fejlbesked. (og jeg vil gerne prøve at hjælpe, men er først lige kommet til computeren igen :-)
<? $updir = \"\"; //absolute path to where files are uploaded, no trailing slash $sizelim = \"yes\"; //do you want size limitations yes or no $size = \"5000000\"; //if you want size limited how many bytes $certtype = \"no\"; //do you want certain type of file, no recommended $type = \"\"; //what type of file would you like
//error if no file is selected if ($file_name == \"\") { die(\"No file selected to upload\"); } //error if file exists if (file_exists(\"$updir/$file_name\")) { die(\"The file you are trying to upload already exists\"); } //error if file is to big if ($sizelim == \"yes\") { if ($file_size > $size) { die(\"The file you are trying to upload is too big.\"); } } //error if file isn\'t certain type if ($certtype == \"yes\") { if ($type != $file_type) { die(\"The file you are trying to upload is wrong type\"); } } copy($file, \"$updir/$file_name\") or die(\"The file you are trying to upload couldn\'t be copied to the server\"); ?> <html> <head> <title>File Uploaded</title> </head> <body> <p> <h2>File Uploaded</h2> File Name: <? echo \"$file_name\"; ?><br> File Size: <? echo \"$file_size\"; ?><br> File Type: <? echo \"$file_type\"; ?> </p> </body> </html>
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.