Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 10-18-2009, 10:35 PM
  #1
blackpepper
Gampi
 
blackpepper's Avatar
 
Join Date: Jul 2005
Location: metro
Posts: 1,233
iTrader: (0)
blackpepper will become famous soon enough
$FILES php file upload

Hi all,
I am in need of help and would appreciate any-ones suggestions on this one. What I have is a really basic php file upload script..however there is something completely wrong with how it is working.
PHP Code:
<?php
$target 
"upload/";
$target $target basename$_FILES['uploaded']['name']) ;
$ok=1;
if(
move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo 
"The file "basename$_FILES['uploadedfile']['name']). " has been uploaded";
}
else {
echo 
"Sorry, there was a problem uploading your file.";
}
?>
The problem is that the files are generated from a program and automatically are named such as: file.mst , file(1).mst, file(2).mst etc...

PHP uploaded file.mst, but wont do any with the parenthesis. Does anyone know a work around or have an explanation?


Cheers
__________________
blackpepper is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-19-2009, 04:55 PM
  #2
genuineskate
Paladin (Level 15)
 
Join Date: May 2006
Location: USA
Posts: 430
iTrader: (0)
genuineskate is an unknown quantity at this point
I'm not really getting the whole idea of your script, could you go a little more in depth?

Are you submitting from a form with more than 1 upload box?
__________________
Did i help you? Rep me!
genuineskate is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-20-2009, 11:17 PM
  #3
blackpepper
Gampi
 
blackpepper's Avatar
 
Join Date: Jul 2005
Location: metro
Posts: 1,233
iTrader: (0)
blackpepper will become famous soon enough
Hey,
So for some clarification:
I have an old program based out of dos which scans a large database and generates a .mst file with specific parameters inside the file. The first time you generate one of these files, it is called file.mst The second time it is called file(1).mst The third, file(3).mst

PHP is not allowing me to upload files which contain the parenthesis, and I am in search of a work-around.

Cheers
__________________
blackpepper is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-21-2009, 03:22 PM
  #4
genuineskate
Paladin (Level 15)
 
Join Date: May 2006
Location: USA
Posts: 430
iTrader: (0)
genuineskate is an unknown quantity at this point
Hmm.. I can't think of anything right now... try more debugging

It could be the basename....

PHP Code:
<?php
$target 
"upload/"basename($_FILES['uploaded']['name']) ;
if(
move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
  echo 
"The file "basename($_FILES['uploadedfile']['name']). " has been uploaded";
}
else {
echo 
"Sorry, there was a problem uploading your file.";
}
//debug
echo "<b>Path:</b> "$target;
echo 
"<b>Basename:</b> "basename($_FILES['uploaded']['name']);
?>
See what that puts out
__________________
Did i help you? Rep me!

Last edited by genuineskate : 10-21-2009 at 03:25 PM.
genuineskate is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-22-2009, 08:34 AM
  #5
scoutt
Mister Admin to you
 
scoutt's Avatar
 
Join Date: Jul 2001
Posts: 30,730
iTrader: (0)
scoutt is a jewel in the roughscoutt is a jewel in the roughscoutt is a jewel in the rough
what happens when you do upload one with parenthesis? do you get an error what do you get?
__________________
Have a Script or Snippet you want to share?

WWW Standards: HTML 4.01, CSS2.1, CSS3, XHTML 1.0
PHP Standards: PHP Standards
scoutt is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 11:26 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.