janim Posted August 8, 2007 Share Posted August 8, 2007 hi guys i have folder for upload in my server when some one upload his file the sys. upload it into the folder and it's name saved too in DB so i want to download this file by $_GET it's name what is the problem with my code here <?php $exte=$qry['ext']; echo "<a href='upload/$exte'>download</a>"; ?> this will direct me to upload folder why ?? many thanks Quote Link to comment https://forums.phpfreaks.com/topic/63873-how-to-download-file-from-server/ Share on other sites More sharing options...
mrjcfreak Posted August 8, 2007 Share Posted August 8, 2007 1) Has the file uploaded correctly? 2) Is it in the right place (i.e. in a subdirectory called upload which is in the same file as your script 3) Have you used $qry['ext'] = $_GET['file'] to set the value of the link? 4) Please post more code Quote Link to comment https://forums.phpfreaks.com/topic/63873-how-to-download-file-from-server/#findComment-318361 Share on other sites More sharing options...
janim Posted August 8, 2007 Author Share Posted August 8, 2007 after form submition this page will appear <form method="post" action ="submit.php" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="100000"> <br />Maximum Size is 100 KB <input type="file" name="file" style="width: 281px" /><br /> <span class="style6"><br /> </span> <input type="submit" name="submit2" value="Attach"><br /> as you can see this is another form to upload file then i want to insert the file name to DB for download it later you know.. $file_name=$_FILES['file']['name']; include("config.php"); $link=mysql_connect($server,$datauser,$datapass) or die("connection faild becouse".mysql_error()); mysql_select_db($database) or die("No database selected !".mysql_error()); $insert = mysql_query("insert into $table (ext) values ('$file_name')") or die("Could not insert data because ".mysql_error()); so in the DB the name is appear as i want but i think the problem in the link above yes i have upload folder and the file is existing there many thanks Quote Link to comment https://forums.phpfreaks.com/topic/63873-how-to-download-file-from-server/#findComment-318365 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.