PDA

View Full Version : آپلود فایل در وردپرس



hamed15
سه شنبه 06 تیر 1396, 12:57 عصر
با سلام خدمت دوستان من در ورد پرس یک قالب ساختم که توی بخشی از اون یک فرمی دارده که باید فایل آپلود بشه کد های که این زیر میزارم توی php فارق از وردپرس درست کار میکنه اما توی ورد پرس ارور میده



<form action="<?php bloginfo('url') ?>/customer-index2" method="post" enctype="multipart/form-data">Select image to upload: <input type="file" name="image" id="image"><textarea rows="4" cols="40"
name="text"></textarea><input type="submit" value="Upload Image" name="upload"></form>





if(isset($_FILES['image']) && $_POST['text']){
$file = $_FILES['image'];
$text = $_POST['text'];
if($file['error'] == 0 && !empty($file['name'])){
$target = 'folder/' .basename($_FILES['image']['name']);
if(move_uploaded_file($_FILES['image']['tmp_name'],$target)){
$sql = "INSERT INTO `wz_or`(upload,title) VALUES ('$target','$text')";
mysqli_query($con,$sql);
echo 'upload success';
}else{
echo 'there was problem for uploading ';
}
}
}





اینم ارور








( ! ) Warning: move_uploaded_file(folder/AppListIcon.scale-100.png): failed to open stream: No such file or directory in C:\wamp\www\1\wp-content\themes\daneshtranse\customer-index2.php on line 110


Call Stack


#
Time
Memory
Function
Location


1
0.0009
359896
{main}( )
...\index.php:0


2
0.0016
361624
require( 'C:\wamp\www\1\wp-blog-header.php' )
...\index.php:17


3
0.5304
18676616
require_once( 'C:\wamp\www\1\wp-includes\template-loader.php' )
...\wp-blog-header.php:19


4
0.5482
18941296
include( 'C:\wamp\www\1\wp-content\themes\daneshtranse\customer-index2.php' )
...\template-loader.php:74


5
0.5521
18954776
move_uploaded_file (http://www.php.net/function.move-uploaded-file) ( )
...\customer-index2.php:110








( ! ) Warning: move_uploaded_file(): Unable to move 'C:\wamp\tmp\php56B.tmp' to 'folder/AppListIcon.scale-100.png' in C:\wamp\www\1\wp-content\themes\daneshtranse\customer-index2.php on line 110


Call Stack


#
Time
Memory
Function
Location


1
0.0009
359896
{main}( )
...\index.php:0


2
0.0016
361624
require( 'C:\wamp\www\1\wp-blog-header.php' )
...\index.php:17


3
0.5304
18676616
require_once( 'C:\wamp\www\1\wp-includes\template-loader.php' )
...\wp-blog-header.php:19


4
0.5482
18941296
include( 'C:\wamp\www\1\wp-content\themes\daneshtranse\customer-index2.php' )
...\template-loader.php:74


5
0.5521
18954776
move_uploaded_file (http://www.php.net/function.move-uploaded-file) ( )
...\customer-index2.php:110


there was problem for uploading