SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    california
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    file uploads and sessions

    I'm stuck again ... here's my problem:

    I successfully created a script that added a bunch of information for news items to a database and performed an image upload (with the file location and name info stored in the database). However, I later added session control so that I could create an intermediate verification page and now I can't seem to figure out how to pass the file upload info through the sessions.

    I tried just declaring the $_FILES definitions as $_SESSION definitions (like the following) but without success.

    Page 1 --> Gather info and file upload submit

    Page 2 --> Define session variables and display sample (without image)

    i.e.
    $_SESSION['title'] = $_POST['title'];
    $_SESSION['date'] = $_POST['date'];
    $_SESSION['short_descr'] = $_POST['short_descr'];
    $_SESSION['location'] = $_POST['location'];
    $_SESSION['news_image'] = $_FILES['news_image']['tmp_name'];
    $_SESSION['news_image_name'] = $_FILES['news_image']['name'];
    $_SESSION['news_image_size'] = $_FILES['news_image']['size'];
    $_SESSION['news_image_type'] = $_FILES['news_image']['type'];


    Page 3 --> Do file transfer to file system and submit data to database

    $news_image_name = $_SESSION['news_image']['name'];
    move_uploaded_file($news_image, "path/$news_image_name" );


    Suggestions???

  2. #2
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This is a PHP problem, thus it belongs in the PHP forum. Moving there...
    Mike
    It's not who I am underneath, but what I do that defines me.


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
  •