zacourie Posted February 8, 2010 Share Posted February 8, 2010 The form submission works fine, it's just that the file won't upload. I've tried many variations of this and the only thing I can come up with is that maybe it's not working because I'm putting the below code directly into an OS-Commerce page and maybe OSC needs to have things set up a particular way for this to work. Any ideas? (Note: this form successfully uploads a file on one of my static websites that is hosted on a shared server. This site is OSC, therefore dynamic, and on a dedicated server.) Any help is much appreciated. <form class="infoBoxContents" id="freevirtual" name="freevirtual" action="<?php echo $PHP_SELF ?>" method="post" enctype="multipart/form-data"> <fieldset class="acctbl" style="width: 95%; margin-bottom: 1em;"> <ol id="contact" style="list-style-type:none;"> <li> <label for="name">Name:</label> <input id="name" name="name" class="name" type="text" /> </li> <li> <label for="company">Company:</label> <input id="company" name="company" class="company" type="text" /> </li> <li> <label for="phone">Phone:</label> <input id="phone" name="phone" class="phone" type="text" /> </li> <li> <label for="email">Email:</label> <input id="email" name="email" class="email" type="text" /> </li> <li> <label for="sku">Product SKU:</label> <input id="sku" name="sku" class="sku" type="text" /> </li> <li> <br /> <label for="userfile">Upload Your Artwork:</label> <input type="hidden" name="MAX_FILE_SIZE" value="20000000" /><input id="userfile" class="userfile" name="userfile" type="file" /> <strong>MAX UPLOAD: 8MB</strong> <br /> <span style="font-size:10px; color:#FFF333;">Please upload vector or 300dpi images (or higher) only. <br />We prefer EPS and AI files, but you may also <br />submit PSD, PDF, JPEG, GIF, PNG, and BMP <br />files as long as they are high resolution. <br /> <br /> </span> </li> <li> <label for="comments">Comments:</label> <textarea id="comments" name="comments" class="comments"></textarea> </li> <li> <br /> <input id="submit" name="submit" type="submit" value="Submit" /> </li> </ol> </fieldset> </form> <?php } else { ini_set('display_errors', 1); $uploaddir = 'C:\Inetpub\alightpromos\uploads'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile); ini_set('upload_max_filesize','20M'); ini_set('post_max_size', '20M'); ini_set('max_execution_time', '900'); ini_set('max_input_time', '900'); $uploadedpath = "http://" . $_SERVER['HTTP_HOST'] . "/uploads/" . basename($uploadfile); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "<div class='infoBoxContents'><p class='acctbl'>There was an error uploading the file, please try again!</p></div>"; } echo "<div class='infoBoxContents'><p class='acctbl'>Your request has been submitted.</p></div>"; //Send email to us $body = "Name: $name Company: $company Phone: $phone Email: $email Product SKU: $sku Artwork: $uploadedpath Comments: $comments"; $subject = "AP Free Virtual Sample request - $name"; ini_set ('SMTP','mail.alightpromos.com'); mail ('[email protected]',$subject,$body,"From: [email protected]"); } ?> Link to comment https://forums.phpfreaks.com/topic/191426-file-not-uploading-to-folder-in-os-commerce-page/ Share on other sites More sharing options...
zacourie Posted February 9, 2010 Author Share Posted February 9, 2010 Nevermind. I figured it out. Link to comment https://forums.phpfreaks.com/topic/191426-file-not-uploading-to-folder-in-os-commerce-page/#findComment-1009188 Share on other sites More sharing options...
thewooleymammoth Posted February 9, 2010 Share Posted February 9, 2010 topic solved Link to comment https://forums.phpfreaks.com/topic/191426-file-not-uploading-to-folder-in-os-commerce-page/#findComment-1009194 Share on other sites More sharing options...
thewooleymammoth Posted February 9, 2010 Share Posted February 9, 2010 lol my bad you already did Link to comment https://forums.phpfreaks.com/topic/191426-file-not-uploading-to-folder-in-os-commerce-page/#findComment-1009195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.