- 0
Uploading Photos, creating directory and updating row in table.
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By qbrick · Posted
Not a single company as small or large it may be is obligated to subsidize its products and sell them at a loss. Your way of thinking is socialist and as a West German with a German brother state but impoverished by state dictatorship and a socialist command economy situated to the East i can tell you - this kind of thinking very quickly leads to products not being produced anymore at all. -
By Hamid Ganji · Posted
Apple reportedly has a second-generation iPhone Fold planned for 2027 by Hamid Ganji The iPhone Fold is one of the most anticipated tech products expected to debut this fall. It will be Apple’s first foldable iPhone, ushering in a new product category for the company. While the first generation has yet to hit the shelves, a new leak suggests Apple has already begun work on its successor. Chinese leaker Digital Chat Station claims that the second-generation iPhone Fold has already been confirmed, meaning Apple could launch a successor in fall 2027. The foldable iPhone is also reportedly referred to as the “iPhone Ultra,” though it remains unclear whether Apple will ultimately choose that branding, especially as Samsung is rumored to rename the Galaxy Z Fold 8 as the Galaxy Z Fold Ultra this year. The leaker also claims that the second-generation foldable will feature a wider folding display while reusing the same screen found in the first generation. Apple’s first foldable iPhone is expected to feature a 7.8-inch inner display and a 5.3-inch outer screen in a passport-style form factor. It has already been reported that Apple plans to change its iPhone release cycle in 2026 to spread launches throughout the year. Under this strategy, the iPhone Fold is expected to debut this fall alongside the iPhone 18 Pro and iPhone 18 Pro Max. The standard iPhone 18 and iPhone Air 2 are expected to arrive later in 2026 or in early 2027. Speaking of the iPhone Air, Digital Chat Station says Apple remains undecided about a third-generation model. The company is reportedly waiting to see how the iPhone Air 2 performs in the market, and if sales disappoint, a successor may never materialize. As we reported this week, the iPhone Air has not been scrapped from Apple’s plans. The second-generation model is reportedly scheduled for spring 2027 and could introduce upgrades such as an additional rear camera for ultrawide photography and improved battery life. -
By daryld · Posted
ahh yes the good old your opinion differs from mine so you are therefore insane lol destiny 1 had no agenda pushing and was a massive success of a game, if you clearly look online the team for some reason thought they had too many men on the team and went on a woman and dei recruitment drive and we all know how destiny 2 performed from then on in -
By Nas · Posted
The limited imaginations and business acumen of non-dominant players is simply that: the abject lack of creative business acumen. Businesses often want to operate in a financially-rewarding marketplace (free market economics) and/or exit/cash-out at maximal financial recompense. Money is their incentive; regulations are both their obstacles and their tools; politics is their means of influencing the marketplace. Google, in this story's example, is crying that AWS and Azure are "too dominant" -- cuz Google Cloud is not printing as much money as Alphabet wants (although it is still dramatically more than they actually need). The EU DMA should truly follow-the-money and treat the EU as its own sovereign nation in order to protect European market players: Domestic entities are exempt from market-influence regulations until absolute monopoly is achieved; Foreign (non-EU/non-Euro) entities are all regulated via stricter DMA measures whereby regulated partnership with independent domestic entity becomes the only way for foreign entities to 'tip the scale' for favorable financial remunerations. Basically create a dual-track aligning with China's foreign investment models. In my eyes, this is the only way to properly protect the European marketplace beyond the current dot-com/ai-bubble/social-media crazes. -
-
-
Recent Achievements
-
Vistor earned a badge
One Year In
-
kinowa earned a badge
First Post
-
krychek57 went up a rank
Rookie
-
Jaybonaut went up a rank
Grand Master
-
Philsl earned a badge
One Year In
-
-
Popular Contributors
-
Tell a friend
Question
seb86
I am trying to update a table row by adding photos. Now everything in the code below works, except it cannot work fully until I can get the $name = $_GET['name']; to read from the row in the table. If someone can help get it to detect this part then the rest should work.
These are the errors I get because I do not have the name displaying from the property details when creating the directory.
If you read the code below carefully you will see that the other POST fields are there becuase they are not to be overwritten.
This is the full page:-
<? $sql = mysql_query("SELECT * FROM properties WHERE property_id='$id' AND username = '$session->username'"); while($propertyRow = mysql_fetch_array($sql)) { $id = $propertyRow['property_id']; $status = $propertyRow['status']; $saletype = $propertyRow['sale_type']; $category = $propertyRow['category']; $name = $propertyRow['name']; $address = $propertyRow['address']; $village = $propertyRow['village']; $long = $propertyRow['long']; $lat = $propertyRow['lat']; $department = $propertyRow['department']; $postcode = $propertyRow['postcode']; $price = $propertyRow['price']; $featured = $propertyRow['featured']; $dateentered = $propertyRow['date_entered']; $sec = substr($propertyRow['date_entered'],17,2); $minute= substr($propertyRow['date_entered'],14,2); $hour = substr($propertyRow['date_entered'],11,2); $day = substr($propertyRow['date_entered'],8,2); $month = substr($propertyRow['date_entered'],5,2); $year = substr($propertyRow['date_entered'],0,4); $date_entered = $day."/".$month."/".$year." ".$hour.":".$minute.":".$sec; } ?> <form action="write-photos.php?mode=update&?id=<? echo $id; ?>" method="post" enctype="multipart/form-data" style="border:0px; padding:0px; margin:0px;"> <? if($_GET['mode'] == "update") { $id = $_GET['property_id']; $name = $_GET['name']; ///// Upload Photos ///// foreach ($_FILES["photo"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK){ $tmp_name = $_FILES["photo"]["tmp_name"][$key]; $photo = $_FILES["photo"]["file"][$key]; mkdir("$SITEurl/photos/properties/$session->username/$name",0777); $file = preg_replace("/([^a-z0-9])+/i", "-", $photo); move_uploaded_file($tmp_name, "$SITEurl/photo/properties/$session->username/$name"); chmod("$SITEurl/photo/properties/$session->username/$name", 0777); $picno = $key; $PHOTO[] = $photo; $sqlphoto = "UPDATE properties SET photo$picno = '$name' WHERE property_id = '$id'"; if(@mysql_query($sqlphoto)){ $msg = "Photo ".$picno." ".$photo." uploaded.</br>"; }else{ echo mysql_error(); } } } ///// Add Properties to DB ///// $dateentered = date("Y:m:d H:i:s"); $status = $_POST['status']; $sale_type = $_POST['sale_type']; $category = $_POST['category']; $name = addslashes($_POST['name']); $address = $_POST['address']; $village = $_POST['village']; $lng = $_POST['lng']; $lat = $_POST['lat']; $department = $_POST['department']; $telephone = $_POST['telephone']; $mobile = $_POST['mobile']; $email = $_POST['email']; $description_fr = addslashes($_POST['description_fr']); $description_en = addslashes($_POST['description_en']); $price = $_POST['price']; $bedrooms = $_POST['bedrooms']; $bathrooms = $_POST['bathrooms']; $view = $_POST['view']; $meters = $_POST['meters']; $terrain = $_POST['terrain']; $pool = $_POST['pool']; $garage = $_POST['garage']; $garage_size = $_POST['garage_size']; $front_garden = $_POST['front_garden']; $rear_garden = $_POST['rear_garden']; $int_features = $_POST['int_features']; $ext_features = $_POST['ext_features']; $fees = $_POST['fees']; $tax = $_POST['tax']; if(isset($_POST['username'])) { $username = serialize($_POST['username']); }else { $username = ""; } if(isset($_POST['int_features'])) { $int_features = serialize($_POST['int_features']); }else { $int_features = ""; } if(isset($_POST['ext_features'])) { $ext_features = serialize($_POST['ext_features']); }else { $ext_features = ""; } $sql = "UPDATE properties SET ('$id', '$session->username', '$dateentered', '$status', '$sale_type', '$category', '$name', '$address', '$village', '$lng', '$lat', '$department', '$postcode', '$telephone', '$mobile', '$email', '$description_fr', '$description_en', '$price', '', '$bedrooms', '$bathrooms', '$view', '$meters', '$terrain', '$pool', '$garage', '$garage_size', '$front_garden', '$rear_garden', '$int_features', '$ext_features', '$video_tour', 'no', '$fees', '$tax', '$PHOTO[1]', '$PHOTO [2]', '$PHOTO[3]', '$PHOTO[4]', '$PHOTO[5]', '$PHOTO[6]', '$PHOTO[7]', '$PHOTO[8]', '$PHOTO[9]', '$PHOTO[10]', '$PHOTO[11]', '$PHOTO[12]', '', '', '', '1')"; if(@mysql_query($sql)) { $msg = "Your have succesfully added your photos to the property"; }else{ $msg = "There was an error uploading the photos, please contact <a href=\"mailto:[email protected]\">administrators</a> for help!"; } } ?> <div id="content"> <? echo "<h3>".$msg."</h3>"; ?> <div id="sidebar-left"> <ul id="post_options"> <li class="current">Brief Details on Property</li> <li>ID: <? echo $id; ?><br>Name: <? echo $name; ?><br>Department: <? echo $department; ?><br>Price €<? echo $price; ?><br><br>Date Posted: <? echo $dateentered; ?></li> <li class="finish">Finished Adding Photos?</li> <li><select id="post_status" name="status" onchange="if (this.selectedIndex==1){this.form ['check'].style.visibility='visible'}else {this.form['check'].style.visibility='hidden'};"> <option value="">no</option> <option value="">yes</option> </select></li> <li> <b><font color="#0099FF">Please double check your photos are in order as you want them before attaching to the property.</font></b><br><br> <input type="checkbox" name="check" style="visibility:hidden;" onclick="this.form.Submit.disabled = ! this.checked;">Enable Save<br><br> <input class="save" name="Submit" type="submit" value="Save" disabled="disabled"></li> <li class="related"><b>Related Links</b></li> <li><a href="manage.php">Manage All Your Properties</a></li> <li><a href="manage-draft.php">View Your Drafts</a></li> </ul> </div> <div id="write-property"> <script type="text/javascript"> /* This function is called when user selects file in file dialog */ function checkext(upload_field) { var re_text = /\.jpeg|\.jpg/i; var filename = upload_field.value; /* Checking file type */ if (filename.search(re_text) == -1) { alert("Please select a JPEG file."); upload_field.value = ''; } return true; } </script> <table width="100%" border="0" cellpadding="0" cellspacing="4"> <tr> <td>Main Photo</td> <td><input name="photo[1]" type="file" id="photo[1]" title="This field is required" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 2</td> <td><input name="photo[2]" type="file" id="photo[2]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 3</td> <td><input name="photo[3]" type="file" id="photo[3]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 4</td> <td><input name="photo[4]" type="file" id="photo[4]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 5</td> <td><input name="photo[5]" type="file" id="photo[5]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 6</td> <td><input name="photo[6]" type="file" id="photo[6]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 7</td> <td><input name="photo[7]" type="file" id="photo[7]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 8</td> <td><input name="photo[8]" type="file" id="photo[8]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 9</td> <td><input name="photo[9]" type="file" id="photo[9]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 10</td> <td><input name="photo[10]" type="file" id="photo[10]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 11</td> <td><input name="photo[11]" type="file" id="photo[11]" size="30" onChange="return checkext(this)"></td> </tr> <tr> <td>Photo 12</td> <td><input name="photo[12]" type="file" id="photo[12]" size="30" onChange="return checkext(this)"></td> </tr> </table> </div> </div> <input name="MAX_FILE_SIZE" type="hidden" value="<?php echo $MAXimagesize; ?>"> </form>This is the part that needs fixing:-
if($_GET['mode'] == "update") { $id = $_GET['property_id']; $name = $_GET['name']; ///// Upload Photos ///// foreach ($_FILES["photo"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK){ $tmp_name = $_FILES["photo"]["tmp_name"][$key]; $photo = $_FILES["photo"]["file"][$key]; mkdir("$SITEurl/photos/properties/$session->username/$name",0777); $file = preg_replace("/([^a-z0-9])+/i", "-", $photo); move_uploaded_file($tmp_name, "$SITEurl/photo/properties/$session->username/$name"); chmod("$SITEurl/photo/properties/$session->username/$name", 0777); $picno = $key; $PHOTO[] = $photo; $sqlphoto = "UPDATE properties SET photo$picno = '$name' WHERE property_id = '$id'"; if(@mysql_query($sqlphoto)){ $msg = "Photo ".$picno." ".$photo." uploaded.</br>"; }else{ echo mysql_error(); } } }Now if the error was to show again because of something else the warning should read like this:-
Warning: mkdir(http://www.site.com/photos/properties/username/name) [function.mkdir]: No such file or directory in
/home/account/public_html/panel/write-photos.php on line 158
Warning: move_uploaded_file(http://www.site.com/photo/properties/username/name) [function.move-uploaded-file]: failed to open
stream: HTTP wrapper does not support writeable connections. in /home/account/public_html/panel/write-photos.php on line 160
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpv1BtAb' to
'http://www.site.com/photo/properties/username/name' in /home/account/public_html/panel/write-photos.php on line 160
Warning: chmod() [function.chmod]: No such file or directory in /home/account/public_html/panel/write-photos.php on line 161
Notice name in bold, that part is not reading from the table, that is whats missing. I would really like to get this to work.
Link to comment
https://www.neowin.net/forum/topic/649976-uploading-photos-creating-directory-and-updating-row-in-table/Share on other sites
20 answers to this question
Recommended Posts