PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 4th, 2012, 11:53 PM
Saves Saves is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 16 Saves User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 57 sec
Reputation Power: 0
How to allow users to upload files in a form?

I want users to be able to upload zip/winrar files only with a browse file input on a form. I want the files to be added to a folder on my ftp server called ../user_upload/

I have this coded in php:

PHP Code:
 $string '0123456789';
$string_shuffle str_shuffle($string);
$half substr($string_shuffled03);
$filename $half;


    
$newname "$filename.jpg";
    
move_uploaded_file$_FILES['fileField']['tmp_name'], "../user_upload/$newname"); 


and then here is the html:

Code:
div class="row_upload">
<div class="label">Upload Track(s)</div> <!-- end .label-->
<div class="input">
<input type="file" accept="application/zip,application/rar" name="fileField" id="fileField" value="test" />
</div> <!-- end .input -->
<div class="context">Upload your track(s) inside of a .ZIP or .RAR file ONLY</div><!-- end .context -->
</div> <!-- end .row -->


It won't work if anyone can help me it would be greatly appreciated!!

Reply With Quote
  #2  
Old November 5th, 2012, 06:56 AM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,879 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 2 Weeks 1 Day 13 h 28 m 18 sec
Reputation Power: 581
Search engines are your friend.

http://www.tizag.com/phpT/fileupload.php
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.

Reply With Quote
  #3  
Old November 5th, 2012, 09:45 AM
Saves Saves is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 16 Saves User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 57 sec
Reputation Power: 0
Quote:
Originally Posted by gw1500se
Search engines are your friend.

http://www.tizag.com/phpT/fileupload.php


I actually used the code from that website prior to posting here. The code is not working for some reason. All the validation checks and renaming existing files are not of my concern. The file won't upload to the folder

Reply With Quote
  #4  
Old November 5th, 2012, 09:54 AM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,879 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 2 Weeks 1 Day 13 h 28 m 18 sec
Reputation Power: 581
Perhaps you did not post enough of your code. For example where is your form and what 'action' does it call? Also do the following to see if $_FILES contains what you expect.
PHP Code:
echo "<pre>";
print_r($_FILES);
echo 
"</pre>"

Reply With Quote
  #5  
Old November 5th, 2012, 10:05 AM
piperpam27 piperpam27 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 47 piperpam27 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 51 m 3 sec
Reputation Power: 1
It's also definitely possible that the permissions on your upload directory are too strict to allow an upload. What OS are you using?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > How to allow users to upload files in a form?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap