Jump to content

Search the Community

Showing results for tags 'php upload script directory p'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi, I'm trying to incorporate a very simple php upload file link script into my website, but it doesn't seem to be running correctly. I'm using a very simple html form set up to activate the script. I know I have the correct coding and syntax set up because I'm using an already coded script from a php developer. My inquiry has to do with folder and file placement on the root directory. I have php 5.3 installed on the server. Does the php file and the html file that runs the code have to be in a special folder other than the public_html folder or can it be amongst the other site files? I know there needs to be an "upload" folder to place the uploaded files, but do the php and html files need to be in that folder too? When I try to run the script, all I get is a blank web page, but the url shows the php file in the address. FORM: <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" name="myfile" size="30" /> <input type="file" name="myfile" size="30" /><br/> <input type="submit" value="Upload" /> </form> PHP: <?php $uploaddir = "uploads/"; $allowed_ext = "pdf, doc, dotx"; $max_size = "20000"; $extension = pathinfo($_FILES['file']['name']); $extension = $extension[extension]; $allowed_paths = explode(", ", $allowed_ext); for ($i = 0; $i < count ($allowed_paths); $i++); { if ($allowed_paths[$i] == "$extension"); { $ok = "1"; } if ($ok == "1") { if($_FILES['myfile']['size'] > $max_size); } echo "File is too big."; exit; } if (is_upload_file($_FILES['myfile']['tmp_name'])) { move_upload_file($_FILES['myfile']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']); echo "Your file has been uploaded successfully."; } else { echo "Incorrect file extension."; } ?> Thanks!
×
×
  • 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.