Jump to content

[SOLVED] dbquery


niki

Recommended Posts

uploadify.php

 

<?php

if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];


if (move_uploaded_file($tempFile,$targetFile)) {

                        dbconnect($dbhost, $dbusername, $dbpassword, $dbname);
		dbquery("INSERT INTO `test` (`test`)
			VALUES ('test')");

 }
}
?>

 

 

and  test.php

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Uploadify Example Script</title>
<link href="/example/css/default.css" rel="stylesheet" type="text/css" />
<link href="/example/css/uploadify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/example/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/example/scripts/swfobject.js"></script>
<script type="text/javascript" src="/example/scripts/jquery.uploadify.v2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
	'uploader'       : 'scripts/uploadify.swf',
	'script'         : 'scripts/uploadify.php',
	'cancelImg'      : 'cancel.png',
	'folder'         : 'publicdemos/map/',
	'queueID'        : 'fileQueue',
	'auto'           : true,
	'multi'          : true
});
});
</script>
</head>

<body>
<div id="fileQueue"></div>
<input type="file" name="uploadify" id="uploadify" />
<p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">Cancel All Uploads</a></p>
</body>
</html>

 

Dont know whats the problem,because file is uploaded successfully....

Only the data is not entered in the mysql table...

Link to comment
Share on other sites

how does uploadify.php know about

- dbconnect() function

- $dbhost, $dbusername, $dbpassword & $dbname variables..

 

You should include a library file which contains the above listed function and variables, if not already included.

 

 

Code: [select]

<?php

 

if (!empty($_FILES)) {

$tempFile = $_FILES['Filedata']['tmp_name'];

$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';

$targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

 

 

if (move_uploaded_file($tempFile,$targetFile)) {

 

                        dbconnect($dbhost, $dbusername, $dbpassword, $dbname);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.