Darkwoods Posted October 11, 2008 Share Posted October 11, 2008 hey.. when i upload a file named with spaces like for example ''file name.jpg'' it does not send the full name to mysql it just send 'file' plus to make a link to it it wont work because no % in spaces so the best thing is to put underscore in spaces but how what are codes thanks herer is the upload page <?php include "inc/header.php"; $id = $_GET['id']; if(isset($_POST['submit'])) { //global variables include "inc/variables.php"; $name=$_POST['name']; $pic=($_FILES['downl']['name']); $result = mysql_query("UPDATE contents SET title_en='$title_en', title_ar='$title_ar', en='$en', ar='$ar', cat='$cat', downl='$pic', name='$name' WHERE id='$id' ",$connect); echo "<b>Your post have been added successfully"; echo "<meta http-equiv=Refresh content=2;url=index.php>"; } //the directory where images will be saved $target = "uploads/downloads/"; $target = $target . basename( $_FILES['downl']['name']); //Writes the filedw to the server if(move_uploaded_file($_FILES['downl']['tmp_name'], $target)) { //Tells you if it the upload were done echo "The file ". basename( $_FILES['downl']['name']). " has been uploaded, and your information has been added to the directory"; } $result = mysql_query("SELECT * FROM contents WHERE id='$id' ",$connect); while($row = mysql_fetch_assoc($result)) { $title_ar = $row["title_ar"]; $title_en = $row["title_en"]; $en = $row["en"]; $ar= $row["ar"]; $cat= $row["cat"]; $name= $row["name"]; $pic= $row["downl"]; ?> <h3>:: Edit Uploaded Software</h3> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?id=<?php echo $row['id']?>" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?php echo $row['id']?>"> <table border="0" cellspacing="4" cellpadding="4"> <tr> <td>Select Category:</td> <td colspan="2"><select name="cat"><option value="3">Download</option></select> </td> </tr> <tr> <td>Title:</td> <td ><input name="title_en" size="40" maxlength="255" value="<?php echo $title_en; ?>"></td> <td><input name="title_ar" size="40" maxlength="255" value="<?php echo $title_ar; ?>"></td> </tr> <tr> <td>Content:</td> <td><textarea name="en" rows="7" cols="30"><?php echo $en; ?></textarea></td> <td><textarea name="ar" rows="7" cols="30"><?php echo $ar; ?></textarea></td> </tr> <tr> <td>Software:</td> <td><input name="name" size="40" maxlength="255" value="<?php echo $name; ?>"> <td><input type="file" name="downl"> </td> </tr> <tr> <td colspan="3" class="submit"><input type="submit" name="submit" value="Add"></td> </tr> </table> </form> <?php } include "inc/footer.php"; ?> Quote Link to comment Share on other sites More sharing options...
waynew Posted October 11, 2008 Share Posted October 11, 2008 $name = str_replace(" ","_",$name); Quote Link to comment Share on other sites More sharing options...
Darkwoods Posted October 11, 2008 Author Share Posted October 11, 2008 $name = str_replace(" ","_",$name); thanks do i put it any where in the page and it will work? Quote Link to comment Share on other sites More sharing options...
bothwell Posted October 11, 2008 Share Posted October 11, 2008 $name = str_replace(" ","_",$name); thanks do i put it any where in the page and it will work? Put it directly underneath $name=$_POST['name']; Quote Link to comment 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.