Array to string conversion
Posted on
16th Feb 2014 07:03 pm by
admin
Can anyone help me with this?
Notice: Array to string conversion in /home/..../index.php on line 360
Whatever this is, it's causing the script to fail at uploading.
Code (starting just before line 360)
Code: (php) <?php
//snip
$ipadd = $_POST['ipadd'];
$filename = $_FILES['uploadfile'];
$save_path = $config['uploaddir'];
$extension = end(explode('.', $filename)); #extension of the file #LINE 360
$fid = rand(1690, 16901690);
$renamed = md5($filename. time()); #rename of the file
if (!@move_uploaded_file($_FILES['uploadfile']['tmp_name'], $save_path.$renamed. $extension)) {
/*if(move_uploaded_file($_FILES['uploadfile']['tmp_name'], $target_path)) {*/
$username = $_SESSION['username'];
$filel = "$save_path.$renamed. $extension.";
$query = "INSERT INTO `files`(owner, filelocation, ipadd, fid)
VALUES('$username', '$filel', '$ipadd', '$fid')";
$result = $sql->query($query);
$content = '<h1>The file has been uploaded!</h1>
<h2>You may download it <a href="?action=downloadFile&file='.$fid.'" target="_blank">here.</a></h2>
<p>Thank you for uploading the file to our file sharing service.</p>
<p>It has now been uploaded and is ready for downloads.</p>
<p>Copy and paste this link for distributing the file.</p>
<p>http://www.'.$_SERVER['SERVER_NAME'].'/?action=downloadFile&file='.$fid.'</p>';
//echo "The file ". basename( $_FILES['uploadfile']['name'])." has been uploaded";
} else{
$content = '<h1>File Upload Error</h1>
<h2>Oops, the file couldn&#39;t be uploaded!</h2>
<p>The file you tried to upload has NOT been uploaded.</p>
<p>This could be because:<br />
- the file is already on the server<br />
- the server is full<br />
- the file was named the same as an already existing file<br />
- the server is not accepting new uploads.</p>
<p>Please contact our support team or the webmaster.</p>';
}
?>
Thanks in advance
No comments posted yet
Your Answer:
Login to answer
339
8
Other forums
Uploading files/images via forms
Hey all, I am building a database for work that will contain some minor data on plant species along
how do i display data on a page from mysql
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a s
Running a cron job through PHP/Apache?!
Hello all,
I have a PHP script which makes a cron file from user input. When i try to run the cro
Please Help my PHP Dating Function.
Hi everyone!
Well here is my code that displays this:
It works wonderful.
is_dir() problem
Hello,
I'm buidling a php scripts that dynamically get's subfolders from a specific folder.
xml element exists
Code: [Select]<?xml version="1.0"?>
<Addresses>
<
path to include folder
Hi everyone,
When I'm testing locally, I have to add the name of the site folder as part of t
foreach and array need help combining
Hi guys.
Here's the code
Code: array(
'tag' => 'code',<
Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the
DateObject and Nulls
Hi all,
I have an array mapped to a value object. One of the items in the array is a PHP Date