- 0
Uploading Photos, creating directory and updating row in table.
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By Copernic · Posted
eM Client 10.4.5600.0 by Razvan Serea eM Client is a full featured e-mail client with a modern and easy to use interface. eM Client also offers calendar, tasks, contacts and chat. eM Client supports all major services including Gmail, Exchange, iCloud, and Outlook.com. You can easily import your data from most of the other e-mail clients. This includes Microsoft Outlook, Outlook Express, Windows Mail, Windows Live Mail, Thunderbird, The Bat and more. eM Client fully supports touch devices like touch-enabled laptops, tablets and hybrid devices. Use your email client easily in a modern way. eM Client PRO vs. Free version While the Free license allows you to set up the maximum of two accounts in the application, it is possible to add an unlimited number of accounts with the PRO license. The PRO license also enables you to use eM Client for commercial purposes. Commercial use is any activity that helps you make profit, the Free license therefore cannot be used in company settings or on personal computers for business correspondence. PRO users also gain access to the dedicated support system and to the licensing manager. eM Client has been fully optimized to run smoothly on Windows Vista, 7, 8, 10 and 11. eM Client 10.4.5600.0 changelog: Improved memory management Improved MS Teams support A lot of other fixes Download: eM Client 10.4.5600 | 128.0 MB (Free, paid upgrade available) View: eM Client Website | eM Client Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware -
By Nas · Posted
Re: Capitalism. It's just 1 of dozens of economic models currently-adopted worldwide; most national models separate money from politics thereby limiting the influence wealth carries over the economy (due to limited tentacles wealth politics has over the broader economy). The "American model" of unfettered financial influence should NOT be the variant of pure capitalism adopted worldwide. More regulations formulated within this variant is effectively useless due to the misalignment between regulatory objectives and fundamental influence wealth politics carry over the market. Re: enough money. Without constraining the breadth/depth/scope/scale that any measure of money/wealth can have within a market, there will always inherently be those who have "enough money" and those who do not. Those without "enough money" will always lose -- regardless if a bedroom DJ, indie developer, or million-dollar corporation going against a billion-dollar mega-corporation. The evil is the absence of guardrails against the influence of wealth; not the mere existence of wealth. Re: dragged through the courts. The liberalist nature of litigation does not exclude anyone, anywhere, for any reason for getting dragged through the courts. Rather than formalize remediation pathways for various perceived ills, everything is left up to flawed interpretations... and this is where a litigation-averse community fails to thrive (thus a losing proposition when dragged to courts). Everyone should have more protections and clear remediation strategies! Going to an alternate remediation arbitration is OK so long as the case review and remediation processes are clear and transparent. For corporations, hit them where it hurts: automatic financial penalties. (PS: This is where corporate risk management strategies would do well to behave more ethically.) Overall, failure to truly shake-up the incentive core and regulatory extremities of the economic market will necessarily mean that all other actions are simply applying lipstick on a pig. Change begins from the inside. Is the root cause of the problem that a majority of consumers within a market goes for Option Brand-name versus Option Indie? Or that brand-name is spending foreign money to control domestic markets? Or that money is the objective measure for success across all walks of life? Or that deep pockets dictate the moral and ethical rights/wrongs of entire societies? Regardless of the answer (and there's nothing inherently wrong with being a socialist or communist or whatever label your surroundings deem 'cool' or 'uncool') there's a common thread: If a market truly wants to nurture domestic innovation, then performative finger-wagging will do nothing to that end. -
By +pmrd · Posted
Lol, I won't even bother explaining the joke to you. -
By Fleet Command · Posted
Does anyone remember the time when VSCode was a lightweight solution, just shy of 40 MB? No? -
-
-
Recent Achievements
-
Admir earned a badge
Conversation Starter
-
The_Focal_Point earned a badge
First Post
-
daryld went up a rank
Apprentice
-
Carltonbar went up a rank
Contributor
-
The_Focal_Point earned a badge
One Month Later
-
-
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