Jump to content

Upload picture via script


fazzfarrell

Recommended Posts

I have this script on my page that works to upload pictures and text to a database.

[/code]

require_once("FXInc/uploadAction.inc");

$errMsg = "";

$action = true;

$noPath = true;

$rename = true;

$delete = true;

$FX_successRedirect = "";

$FX_DirPath = "../";

$FX_typearray = array("image");

$FX_extarray = array("jpg","jpeg","gif");

$FX_size = "100000";

$FX_fields = array();

if ((isset($HTTP_POST_VARS["FX_upload"])) && ($HTTP_POST_VARS["FX_upload"] == "form1")) {

  require_once("FXInc/upload.inc");

}

 

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

 

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {

  $updateSQL = sprintf("UPDATE images SET Sec=%s, Pic=%s, Title=%s, catID=%s, Text=%s, PrintCost=%s WHERE ID=%s",

                      GetSQLValueString($_POST['Sec'], "text"),

                      GetSQLValueString($_POST['Pic'], "text"),

                      GetSQLValueString($_POST['Title'], "text"),

                      GetSQLValueString($_POST['catID'], "text"),

                      GetSQLValueString($_POST['Text'], "text"),

                      GetSQLValueString($_POST['PrintCost'], "text"),

                      GetSQLValueString($_POST['ID'], "int"));

 

  mysql_select_db($database_fon, $fon);

  $Result1 = mysql_query($updateSQL, $fon) or die(mysql_error());

 

  $updateGoTo = "edit.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";

    $updateGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $updateGoTo));

}

 

$colname_rsEntries = "-1";

if (isset($_GET['ID'])) {

  $colname_rsEntries = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);

}

 

The problem is that my pictures on my site are all split inti different folder and the line

 

$FX_DirPath = "../";

only put them in the root of the site, I need each upload to go into the relevant folder, I have tried

 

$FX_DirPath = "../$row_rsEntries['Sec']";

 

any one help

Link to comment
https://forums.phpfreaks.com/topic/59224-upload-picture-via-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.