Jurik Posted October 19, 2006 Share Posted October 19, 2006 Hi guys I think im having a problem with getting my videos to save from a linex server to a windows server, the problem i'm having is with the path on the script it does not work when I put my code onto the linex server but works fine on my windows PC, at the moment im using the following path \\\benin\\videolibrary\\This path works fine untill I upload it to the Linex server and then the apth no longer works, does anyone know how I can resolves this problem? Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/ Share on other sites More sharing options...
Daniel0 Posted October 19, 2006 Share Posted October 19, 2006 You can fix it using this:[code]$path = str_replace('\\','/',$path);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111171 Share on other sites More sharing options...
Jurik Posted October 19, 2006 Author Share Posted October 19, 2006 [quote author=Daniel0 link=topic=112005.msg454280#msg454280 date=1161257894]You can fix it using this:[code]$path = str_replace('\\','/',$path);[/code][/quote]Huh sorry you have lost me do i replace$target_path = "\\\benin\\Videolibrary\\";with or after the above?$path = str_replace('\\','/',$path); Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111219 Share on other sites More sharing options...
Daniel0 Posted October 19, 2006 Share Posted October 19, 2006 After. Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111221 Share on other sites More sharing options...
Jurik Posted October 19, 2006 Author Share Posted October 19, 2006 hhmmm nope it still anit having it, have I put the code in right? Heres what I got[quote]<?phpif (isset($_POST['submit'])) { $VideoID = $_POST['VideoID']; $Name = $_POST['Name']; $submit = $_POST['submit'];} else { $VideoID = ""; $Name = ""; $submit = "";}$success = 0;if ($submit == "Save" && $VideoID != NULL && $Name != NULL){ if ($_FILES['uploadedfile']['error'] != 0) { $success = 0; echo "There was an error uploading the file, please try again!"; } else { $target_path = "\\\benin\\Videolibrary\\"; path = str_replace('\\','/',$path); $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $smell = basename( $_FILES['uploadedfile']['name']); if (file_exists ($target_path)) { $success = 0; echo "The file already exists"; } else { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again! - This one"; } $sql = "INSERT INTO videos (VideoID,Videofile,Name) VALUES ('" . $VideoID . "', '" . mysql_real_escape_string ($smell) . "', '" . $Name . "')"; include "conn.inc.php"; $result = mysql_query($sql) or die (mysql_error ()); if(mysql_affected_rows() == 1) { $success = 1; } else { echo("I'm afraid an error has been detected, please check the information entered again. If the problem persists then contact IT support"); } } }}if($success != 1) {?>[/quote]Am not quite sure if I got the code bit u gave me right Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111223 Share on other sites More sharing options...
Daniel0 Posted October 19, 2006 Share Posted October 19, 2006 Change [code] path = str_replace('\\','/',$path);[/code] to [code] $target_path = str_replace('\\','/',$path);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111226 Share on other sites More sharing options...
Jurik Posted October 19, 2006 Author Share Posted October 19, 2006 hhhmmm nope sorry but it didnt work, I hate to be a pain but can u still help me out? Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111232 Share on other sites More sharing options...
kenrbnsn Posted October 19, 2006 Share Posted October 19, 2006 What, exactly, are you trying to do?If the script is running on a Linux server, how do expect it to be able to save a file on a Windows server?Ken Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111234 Share on other sites More sharing options...
printf Posted October 19, 2006 Share Posted October 19, 2006 if your on Windows or Linux, or Unix, or Mac, always use forward slashes, Windows understands them, like all the rest!So this...[code] $target_path = "\\\benin\\Videolibrary\\"; path = str_replace('\\','/',$path); $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); [/code]Could be written like this..[code] $target_path = "./benin/Videolibrary/"; $target_path .= basename( $_FILES['uploadedfile']['name'] ); [/code]me! Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111237 Share on other sites More sharing options...
Jurik Posted October 19, 2006 Author Share Posted October 19, 2006 What I am trying to do is upload a file that is selected by the user, after the user clicks Save it will then put the file onto a server. The php files are running of a Linex server but the server it gets off and saves to are window servers. Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111267 Share on other sites More sharing options...
Jurik Posted October 19, 2006 Author Share Posted October 19, 2006 [quote author=printf link=topic=112005.msg454346#msg454346 date=1161264839]if your on Windows or Linux, or Unix, or Mac, always use forward slashes, Windows understands them, like all the rest!So this...[code] $target_path = "\\\benin\\Videolibrary\\"; path = str_replace('\\','/',$path); $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); [/code]Could be written like this..[code] $target_path = "./benin/Videolibrary/"; $target_path .= basename( $_FILES['uploadedfile']['name'] ); [/code]me![/quote]Nope im still getting the same error, this problem is really weird. It just dont seem to want to be fixed Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111272 Share on other sites More sharing options...
kenrbnsn Posted October 19, 2006 Share Posted October 19, 2006 If the script is running on a Linux server the files will be saved to the Linux server. PHP running on the Linux server has no knowledge of the Windows server.Ken Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111276 Share on other sites More sharing options...
Jurik Posted October 19, 2006 Author Share Posted October 19, 2006 [quote author=kenrbnsn link=topic=112005.msg454385#msg454385 date=1161267270]If the script is running on a Linux server the files will be saved to the Linux server. PHP running on the Linux server has no knowledge of the Windows server.Ken[/quote]hhhmmm ok, I changed the path so that it saves the file in a folder in the same directory as the php files and I still get the same error, could this be because I am selecting files off a windows system to be saved onto a linex server? If what you say ken is true is there a way to make it knowlegable of the windows servers and thus save onto them? Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111280 Share on other sites More sharing options...
kenrbnsn Posted October 19, 2006 Share Posted October 19, 2006 The only way for a script running on a Linux server to store files in a Windows directory is if the Windows directory is available to the Linux server via Samba or NFS.Ken Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111290 Share on other sites More sharing options...
Jurik Posted October 19, 2006 Author Share Posted October 19, 2006 Right I have no knowledge of Linex so i'll meantion it to me boss who knows more bout Linex than me, cheers Quote Link to comment https://forums.phpfreaks.com/topic/24431-linex-to-windows-path-address-problems/#findComment-111299 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.