Search the Community
Showing results for tags 'uploads'.
-
Hi, I have the attached page that uploads files to the server and then emails the intended recipient, however I can't figure out how to include the link to the uploaded files. Everything else works just fine, so any help on this would be much appreciated. thanks, MsKazza P.s. if anyone could point me in the direction of how to make my upload section like the attach files portion of these forum posts would love to upgrade mine. thanks. index.php
-
I'm working on a two-file upload form and want to be able to check the mime types of two filenames in a string variable. The code below was working when the variable @resume_path contained just one filename. How can I modify this to accommodate two files? when I echo $resume_path, I get, for example: cover_letter_centerline.doc, cover_letter_ctg.doc Thanks! //DO NOT TRUST $_FILES['upfile']['mime'] VALUE !! //Check MIME Type by yourself. $finfo = new finfo(FILEINFO_MIME_TYPE); if (false === $ext = array_search( $finfo->file($_FILES['resume_path']['tmp_name']), array( 'txt' => 'text/plain', 'doc' => 'application/msword', 'pdf' => 'application/pdf', ), true )) { throw new RuntimeException('Invalid file format.'); } echo "Sorry, invalid file format. Please try again."; echo $ext;
-
Apologies if this is in the wrong section, as I'm not too sure what I would need for the things I'm wanting, and I would like to constrain it to one topic if possible. I had an idea for a gaming community site (http://gamer-cafe.net/), and so far I have a bare-bones layout but I would like an image gallery, and a mod gallery. Problem is, I don't know what to begin learning to even get a basic version of either going This is what I hope to achieve at the end; Content uploads are member restricted Users can upload an image of their favourite moment in gaming Users can upload a mod to improve others games Users must include a minimum of one image, a title, a short description, and 4 tags with their upload(s) Users can then download, comment, and rate the content Site will automatically grab thumbnails of the content Content originating from the user will display on their profile I use PhPBB for the users credentials, so it would need to integrate with that so I could get the users names etc for comments I know it's a lot, and it's going to take a while aha but I'm up for it and determined, what would I need to learn to get something like these working?
-
Hi all, First time poster. I'm a novice at PHP, trying to work it out. Right now I'm trying to write something that is a rough approximation of the old 1990s Geocities site. The goal here is to have a file uploader form with 5 uploaders by default, but the user can add more as he pleases. Most of the form elements are in plain old HTML, but I gotta use PHP to generate the block of the form that has the upload button. I'm trying to do this with classes. At this point, I'm just trying to get the PHP script to acknowledge that it received and uploaded the file. Actually putting it in the right place comes later. Here's what I have so far. I'm sorry it's a little sparse on comments. <div id="uploaderBox"> <form action="uploadpage.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> <?php //Create new uploaderBlock object. $myUploader = new uploaderBlock(2); //Should be interpreted as if(isset($_FILES['uploader2'] if(isset($_FILES[$myUploader->getUploaderName()])) $myUploader->getUploadedFile(); else print "Nothing uploaded yet!"; ?> <input type="submit" name="submitButton" value="Upload now!" /> </form> </div> <?php class uploaderBlock { private $uploaderName; public function __construct($upNumber) { $this->uploaderName = "uploader" .$upNumber; $this->makeUploaderBlock(); } public function makeUploaderBlock() { print '<input type="file" name="' .$this->uploaderName .'" />'; print "<br />\n"; } public function getUploadedFile() { print "UPLOADED FILE:<br />"; print $_FILES[$this->uploaderName]; } public function getUploaderName() { return $this->uploaderName; } } ?> The problem is that the script never seems to realize that a file has been uploaded. The if(isset($_FILES[$myUploader->getUploaderName()])) statement always evaluates to FALSE. If I remove the if-else and just run the $myUploader->getUploadedFile(); statement, I get the error Notice: Undefined index: uploader2 in C:\Dropbox\xampp\htdocs\projects\FinalProject\uploadpage.php on line 43 It's funny because I thought I understood this. Last week I did this little test script which works fine. I can't figure out what I'm doing differently. I mean, in the earlier script I'm using pure HTML for the entire form, and no objects. <form action="file_io_test.php" enctype="multipart/form-data" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> <input type="file" name="uploader1" /><br /> <input type="submit" name="submitbutton" value="Upload!" /> </form> <?php $infile = "stuff.txt"; $uploader = 'uploader1'; if(isset($_FILES[$uploader]['name'])) { $fileName = $_FILES[$uploader]['name']; move_uploaded_file($_FILES[$uploader]['tmp_name'], 'uploads/' .$fileName); } else print "Nothing uploaded yet!"; ?>