Jump to content

Search the Community

Showing results for tags 'files firectory form'.

  • 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. How do you use a form to select where files get moved to after being uploaded, and for zip files, unzipped?? No matter what I try doing, they show up at /full_path/calendar/images/ instead of /full_path/calendar/images/FormInfo. <?php if($_FILES["zip_file"]["name"]) { $filename = $_FILES["zip_file"]["name"]; $directory = $_FILES["directory"]["name"]; //Is this even correct?? $source = $_FILES["zip_file"]["tmp_name"]; $type = $_FILES["zip_file"]["type"]; $name = explode(".", $filename); $accepted_types = array('application/zip', 'application/tiff', 'application/png', 'application/gif', 'application/jpg', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed'); foreach($accepted_types as $mime_type) { if($mime_type == $type) { $okay = true; break; } } $continue = strtolower($name[1]) == 'zip' ? true : false; if(!$continue) { $message = "The file you are trying to upload is not a correct file. Please try again."; } $target_path = "/full_path/calendar/images/".$filename; // change this to the correct site path if(move_uploaded_file($source, $target_path)) { $zip = new ZipArchive(); $x = $zip->open($target_path); if ($x === true) { $zip->extractTo("/full_path/calendar/images/"); // change this to the correct site path $zip->close(); unlink($target_path); } $message = "Your file was uploaded. If it was a Zip file, it has also been unzipped."; } else { $message = "There was a problem with the upload. Please try again."; } } ?> <title>File Uploaded</title> </head> <body> <?php if($message) echo "<p>$message</p>"; ?> <form enctype="multipart/form-data" method="post" action=""> <label>Choose an image file to upload. To upload multiple images at one time, convert them to a .zip file and upload. <P><input type="file" name="zip_file" /></label> <P> Select Directory: <select name="directory" id="directory"> <option value="DirectoryName" selected>DirectoryName</option> <P> <input type="submit" name="submit" value="Upload" /> </form> </body> </html>
×
×
  • 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.