Jump to content

Some help with image uploads


wartotojas

Recommended Posts

Hi everybody,

Im realy new guy with php, at the moment trying to build a webpage that would allow people to register, login and upload images (create albums that everybody could see). I managed to create registration and login forms, my sessions are finally working and I started with file uploads and adding them to albums.

 

Im not really sure if its possible to do so, but what Im looking for is that lets say user wants to create an album, hits an upload button and a new folder within server is created with the same name as album, is it possible?

 

to handle file uploads I was following this tutorial:

http://articles.sitepoint.com/article/php-gallery-system-minutes/1

 

Basicaly it would do what Iam looking, but at the very end it doesn't... It connects to my database, uploading form works, confirmation message appears when files are uploaded, records in one of the tables are created, files are renamed but they dont appear anywhere in my server...

 

Is there something missing with this tutorial, and the files that are included? or its just me?

Any hints or any other tutorials that would do same thing would be appreciated?

 

Thanks for help  :shy:

Link to comment
Share on other sites

by deafult move_uploaded_files() will fail to work if the destination directoy doesnt exist, you need to ensure it exists before moving the upload.. the following should surfice

 

<?php

 

if(!is_dir("DESTINATION DIR HERE")){

mkdir("DESTINATION DIR HERE");

}

?>

 

Stuie

Link to comment
Share on other sites

You need to set permissions, but here is concept code..

<?php
function createAlbum() {
  if(!is_dir("/albums/".$row['username']."/".$row['albumname'])){
     mkdir("/albums/".$row['username']."/".$row['albumname']"); //After cleaning and checking for any security risks.
}
//Upload data now using forms..
}

It was something similar to what I did before..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.