Jump to content

Search the Community

Showing results for tags 'fileupload'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

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


Languages

Found 3 results

  1. I am making a music store project.. I want some method so that users can upload mp3 files in it.. i have tried many codes but i cud not do it. please tell me how i can complete this..
  2. Hello. I have a form with 5 textfields and 1 file field. It can already upload the file to a specified folder but I can't make it work when there are multiple textfields.It doesn't insert into the db table. How do you guys do it? <?phpif(isset($_FILES['filename'])){ $errors = array(); $file_name = $_FILES['filename']['name']; $file_size =$_FILES['filename']['size']; $file_tmp =$_FILES['filename']['tmp_name']; $file_type=$_FILES['filename']['type']; $file_ext=strtolower(end(explode('.',$_FILES['filename']['name'])));if(isset($_POST['name_sender'])){ $nameSender = $_POST['name_sender'];}if(isset($_POST['address'])){ $Address = $_POST['address'];}if(isset($_POST['contactno'])){ $contact_no = $_POST['contactno'];}if(isset($_POST['totalsent'])){ $total_sent = $_POST['totalsent'];}if(isset($_POST['datesent'])){ $date_sent = $_POST['datesent'];} $expensions= array("jpeg","jpg","png"); if(in_array($file_ext,$expensions)=== false){ $errors[]="extension not allowed, please choose a JPEG or PNG file."; } if($file_size > 2097152){ $errors[]='File size must be excately 2 MB'; } // if there are no errors... if (empty($errors)==true) { // upload the file... move_uploaded_file($file_tmp,"uploads/".$file_name); $servername = "localhost"; $username = "root"; $password = ""; $dbname = "admin"; // and create a new record in the database mysql_connect($servername, $username, $password) or die ('MySQL Not found // Could Not Connect.'); mysql_select_db("admin") or die(mysql_error()) ; mysql_query("INSERT INTO payment_form (name, address, contactno, totalsent, paymentdate, filename) VALUE ('$nameSender', '$Address', '$contact_no', '$total_sent', '$date_sent', $file_name')") ; echo "Success"; }else{ print_r($errors); }}?> i'm certain the my db table has the corresponding columns. sorry if it's a messy or a wrong way to code.i'm still in the stage of putting together codes that work...
  3. I am making a file upload system. The user chooses where to upload using the dynamic drop down list. And this is the problem I am facing right now. This is my form. <form action="uploader.php" method="POST" enctype="multipart/form-data" name="uploads"> <label for="file">Choose a file: </label> <input type="file" name="userfile" id="userfile"><br/><br/> <select id="text-one" name="one"> <option selected value="base">Select Department</option> <option value="CSE" name="cse">Computer Science Engineering</option> <option value="ECE" name="ece">Electronics & Communication Engineering</option> <option value="MECH" name="mech">Mechanical Engineering</option> </select> <br /><br/> <select id="text-two" name="two"> <option>Select Semester</option> </select> <br /><br/> <select id="text-three" name="three"> <option>Select Subject</option> </select> <br/><br/> <button class ="btn btn-primary" button type="submit" name="upload" value="Upload" onClick="val()">Upload</button> </form> And this is my other php file to which it is linked. <?phpif(isset($_POST['upload'])){ $path1=$_POST['one']."/"; $path2=$_POST['two']."/"; $path3=$_POST['three']."/"; $upload_path=$path1.$path2.$path3;}else{ echo "Select a Subject"; echo "<br>";}$allowed_filetypes = array('.doc','.docx','.jpg','.jpeg','.png','.ppt','.pptx','.xls','.xlsx','.pdf','.txt','.zip','.rar');$max_filesize = 20000000;$filename = $_FILES['userfile']['name'];$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);if(!in_array($ext,$allowed_filetypes)) die("<script LANGUAGE='JavaScript'> window.alert('You cannot upload the following type of file!') window.location.href='upload.php'; </SCRIPT>");if(filesize($_FILES['userfile']['size']) > $max_filesize) die("<script LANGUAGE='JavaScript'> window.alert('The file you attempted to upload is too large!') window.location.href='upload.php'; </SCRIPT>");if(!is_writable($upload_path)) die("<script LANGUAGE='JavaScript'> window.alert('You cannot upload to the specified directory!') window.location.href='upload.php'; </SCRIPT>");if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename)) echo ("<script LANGUAGE='JavaScript'> window.alert('Your file has been uploaded successfully') window.location.href='upload.php'; </SCRIPT>");else echo ("<script LANGUAGE='JavaScript'> window.alert('There was an error during the file upload!') window.location.href='upload.php'; </SCRIPT>");?> I have edited the phpini file with the following settings and also made a .htaccess file in the php folder.upload_max_filesize 25M post_max_size 25M memory_limit 64MBut when I intentionally upload a file greater than 25 MB, I get the error as given in the title. Also, considering the max file size is being violated, it does not give the error related to the file size, i.e The file you attempted to upload is too large, it says You cannot upload the following type of file. And in the background that post length warning thing comes.Please help me with this. I am on my localhost.
×
×
  • Create New...