SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member waterboy's Avatar
    Join Date
    Feb 2003
    Location
    montreal
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Uploading a file or image

    I get these errors :

    Warning: fopen() expects parameter 1 to be string, array given in preview.php on line 10

    Warning: filesize() [function.filesize]: Stat failed for Array (errno=2 - No such file or directory) in preview.php on line 10

    Warning: fread(): supplied argument is not a valid stream resource in preview.php on line 10

    Warning: getimagesize(Array) [function.getimagesize]: failed to create stream: No such file or directory in preview.php on line 11



    When i submit a file from my index.php to preview.php

    Code from index.php


    //start
    echo "<form method=post name=\"new\" onSubmit=\"return isReady(this)\" action=\"preview\" enctype=\"multipart/form-data\">";


    // This is where i select the file name
    </td><td width=\"80%\"><p align=\"left\"><INPUT NAME=\"fimage\" TYPE=\"file\" VALUE='Send image'> </td>
    .
    .
    .//the submit
    <INPUT TYPE=\"submit\" name=\"upload\" VALUE=\"Send File\">";



    Code from preview.php

    //The line that give me the errors
    $data = addslashes(fread(fopen($fimage, "r"), filesize($fimage))); //line 10

    Can anyone help

  2. #2
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use copy or move_uploaded_file to access your file, take a look at the examples in the manual ...http://www.php.net/manual/en/features.file-upload.php

    note especially the use of the $_FILES array


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •