Jump to content
Larry Ullman's Book Forums

juanmc

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by juanmc

  1. You can add file extension types in the control panel of the hosting server so I added for example

    Content Type: applicationzip. Bu, as I said this is not the problem. When I used upload_rtf.php, and changed it to:

    // Check the file:

    if (finfo_file($fileinfo, $_FILES['upload']['tmp_name']) == 'application/zip') {

     

    it retuned file is acceptable, but when I used upload_image with 'application/zip' in the $allowed array

    it didn't work

  2. I have not ben able to resolve the issue for uploading .dwg file etc. An alternative solution would be to allow for .zip file uploads, but this is proving problematic also..

     

    I have used the upload_rtf.php file in chapter 13 to check if .zip file are expectable and get a success message, but the following code allows for .pdf upload but not .zip file: 

     

     

    $allowed = array ('application/zip', 'application/pdf', 'application/octet-stream', 'application/DWG', );
      if (in_array($_FILES['upload']['type'], $allowed)) {

     

    Any suggestions gratefully received

  3. Thanks. I tried all the options but none worked. I don't think it is a browser problem because I can upload these file types using this code:

     

    <?php

    $uploaddir = 'uploads/';
    $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

    echo "<p>";

    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
      echo "File is valid, and was successfully uploaded.\n";
    } else {
       echo "Upload failed";
    }

    echo "</p>";
    echo '<pre>';
    echo 'Here is some more debugging info:';
    print_r($_FILES);
    print "</pre>";

    ?>

     

    But it would suit my purposes better to modify script 11.2

     

  4. Thanks for your help

    .

    The file names are: 1343939490.dwg  or wel4.dxf. I have been able to upload these files with a different script.

     

    I have added 'application/DWG' to the array, but it still doesn't work:

     

    $allowed = array ('application/pdf', 'application/DXF','application/dxf', 'application/DWG', 'application/dwg','image/pjpeg', 'image/jpeg', 'image/JPG', 'image/X-PNG', 'image/PNG', 'image/png', 'image/x-png',);
      if (in_array($_FILES['upload']['type'], $allowed)) {

  5. Chapter 111 script 11.2 works fine for uploading jpegs, pngs etc & when I add 'application/pdf' for pdf files also. But when I add e.g. 'application/DWG' it doesn't work. What is the correct code to upload file types: DXF, IGES, ACIs etc. please?

     

    This is my code:

     

    $allowed = array ('application/octet-stream', 'application/zip', 'application/pdf', 'application/dxf', 'application/x-autocad', 'application/x-dxf', 'drawing/x-dxf', 'image/vnd.dxf', 'image/x-autocad', 'image/x-dxf', 'zz-application/zz-winassoc-dxf','application/igs','application/sat','image\pjpeg', 'image\jpeg', 'image\JPG', 'image\X-PNG', 'image\PNG', 'image\png', 'image\x-png',);
      if (in_array($_FILES['upload']['type'], $allowed)) {

     

×
×
  • Create New...