Upload System

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
chris98
Forum Contributor
Posts: 103
Joined: Tue Jun 11, 2013 10:47 am
Location: England, United Kingdom

Upload System

Post by chris98 »

Hello, I am currently creating an upload system, and I am trying to get a variable into the upload directory.How could I do this?

As you can see below, I have tried several ways, and none seem to be working.Once I remove the variable and replace it with normal text, it works.I have three or four sections, so I don't really want to be creating one for each when I could get it in one, so how could I get it to work?

NOTE: The variable $data_name is the name of my database.The user is asked to select their category via a dropdown box, and then the selected one sends it to that specific table in the database.All the variables do definetly work, as I have tried them.Many many times...

Code: Select all

$minimap_uploadLocation = "c:/wamp/www/strongholdcrusader/downloads/categories/$data_name/pages/minimaps/\\";

Code: Select all

$minimap_uploadLocation = "c:/wamp/www/strongholdcrusader/downloads/categories/".$data_name."/pages/minimaps/\\";
Once I replace either of these ways with the following, it works.

Code: Select all

$minimap_uploadLocation = "c:/wamp/www/strongholdcrusader/downloads/categories/shc_cbuploads/pages/minimaps/\\";
Initially, I tried this, but then soon realised that it wasn't going to work.

Code: Select all

$minimap_uploadLocation = "../categories/".$data_name."pages/minimaps/\\";
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Upload System

Post by Celauran »

So you've confirmed that

Code: Select all

$minimap_uploadLocation = "c:/wamp/www/strongholdcrusader/downloads/categories/$data_name/pages/minimaps/\\";
contains the correct value?

Can you elaborate on 'not working'? How are you trying to upload the files? What error message(s) are you getting?
User avatar
chris98
Forum Contributor
Posts: 103
Joined: Tue Jun 11, 2013 10:47 am
Location: England, United Kingdom

Re: Upload System

Post by chris98 »

I'm not getting any errors, It is uploading them into a database, and I am using only php, no javascript.It adds the name of the upload into the database, because I have seen it in the admin area, but it won't UPLOAD the file.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Upload System

Post by requinix »

You may be getting errors but just can't see them. Find your php.ini and set

Code: Select all

error_reporting = -1
display_errors = on
restart the web server, and try your script again.
User avatar
chris98
Forum Contributor
Posts: 103
Joined: Tue Jun 11, 2013 10:47 am
Location: England, United Kingdom

Re: Upload System

Post by chris98 »

This is on a localhost -- and I have restarted it this morning.I'll try the error reporting.
Post Reply