Problem With Upload Script

Started on the old forum in June 2008 · view the original in the archive · old links redirect here

20 replies · 1,465 views · started 18 years ago · 1 min read

3 participants
synergyx Developer · 100 posts #1

firstly i created a simple upload script called upload.php, with the following code

<html>
<head>
<title>File Upload Form</title>
</head>
<body>
This form allows you to upload a file to the server.

<form action="getfile.php" method="post">

Type (or select) Filename: <input type="file" name="uploadFile">
<input type="hidden" name="MAX_FILE_SIZE" value="25000" />
<input type="submit" value="Upload File">
</form>

</body>
</html>

then i created a getfile script called getfile.php, with following code

<html>
<head>
<title>Process Uploaded File</title>
</head>
<body>
<?php

if ( move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], 
       "../uploads/{$_FILES['uploadFile'] ['name']}")  )
      {  print '

 The file has been successfully uploaded </p>';
       }
else
      { 
        switch ($_FILES['uploadFile'] ['error'])
         {  case 1:
                   print '

 The file is bigger than this PHP installation allows</p>';
                   break;
            case 2:
                   print '

 The file is bigger than this form allows</p>';
                   break;
            case 3:
                   print '

 Only part of the file was uploaded</p>';
                   break;
            case 4:
                   print '

 No file was uploaded</p>';
                   break;
         }
       }

?>
</body>
</html>

nothing happens, i tested it and nothing uploads!!!! whats the problem?

laro696 Developer · 205 posts #2

did u chmod 777 the upload directory?

synergyx Developer · 100 posts #3

just did it, still nothing

laro696 Developer · 205 posts #5

k i see lol getfile.php just shows blank. its like a chat script i have. when you register it just shows blank page

synergyx Developer · 100 posts #6

k i see lol getfile.php just shows blank. its like a chat script i have. when you register it just shows blank page

yes it shows blank and no file is uploaded

laro696 Developer · 205 posts #7

yes it shows blank and no file is uploaded

Maybe try register globals on

synergyx Developer · 100 posts #8

Maybe try register globals on

ok i know im asking again, but where do i find that

laro696 Developer · 205 posts #9

make file called php.ini

paste this in it

register_globals = On
synergyx Developer · 100 posts #10

make file called php.ini

paste this in it

register_globals = On

ok, where do i upload the file, in my main directory?

laro696 Developer · 205 posts #11

yeah where upload.php is

synergyx Developer · 100 posts #12

yeah where upload.php is

i just did and tried to upload and still get nothing

laro696 Developer · 205 posts #13

Maybe your host has it turned off. i know mine does

synergyx Developer · 100 posts #14

Maybe your host has it turned off. i know mine does

ill find out if he has it turned off quick

laro696 Developer · 205 posts #15

Instead of making php.ini you can make .htaccess. Ask your host to enable changing php values via .htaccess


Thanks wappy for teaching me that lol

synergyx Developer · 100 posts #16

Instead of making php.ini you can make .htaccess. Ask your host to enable changing php values via .htaccess


Thanks wappy for teaching me that lol

i have got .htaccess already, i see it on my main dir

ReGzBk Developer · 115 posts #17

put this in ua .htaccess file to make register globals on :-

php_value register_globals 1

And this script looks weird to me ... how u wud use case for errors ?? nd wht if user has not selected any file wht wud be error ?

ViSiT Ma SiTe Nd PoSt Ua CoMmEnTs On It In Ma PoSt

synergyx Developer · 100 posts #18

ok this is whats in my .htaccess

# -FrontPage-

Options None

<Limit GET POST>
order deny,allow
deny from all
allow from all
require group authors administrators
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthType Basic
AuthName synergyx.co.za
AuthUserFile /home/synergyx/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/synergyx/public_html/_vti_pvt/service.grp

what do i change?

ReGzBk Developer · 115 posts #19

Jst add this line :-

php_value register_globals 1

like this :-

ok this is whats in my .htaccess

# -FrontPage-

Options None

<Limit GET POST>
order deny,allow
deny from all
allow from all
require group authors administrators
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthType Basic
AuthName synergyx.co.za
AuthUserFile /home/synergyx/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/synergyx/public_html/_vti_pvt/service.grp
php_value register_globals 1

ViSiT Ma SiTe Nd PoSt Ua CoMmEnTs On It In Ma PoSt

synergyx Developer · 100 posts #20

ok i have done all of this and still the upload script doesnt work, is my script wrong? my .htaccess has been edited and i have spoken to my host and they said i must do the exact same thing, but my luck its still not working External image (may be gone)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close