Ampix0
Power Member
- Jan 10, 2012
- 527
- 60
I am new to PHP and I am creating my first real tool for myself. I am on shared hosting so im not sure about some of the file stuff but basically here is what I have.
And instead of echoing the contents of the file I get this.
Is the temp file already deleted? So I need to move it before reading it? Is there a permission issue?
Code:
<?php
$regexstr = "(?<=FN:)(.*)(?=\n+)";
//RESTRICT TO VCARD ONLY
if ($_FILES["file"]["type"] == "text/x-vcard") {
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br>";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
//FILE UPLOADED
$vcf = file_get_contents($FILES["file"]["tmp_name"]);
echo $vcf;
}
//IF STATEMENT TO CHECK TYPE
}
else{
echo "You may only upload .vcf files.";
}
?>
And instead of echoing the contents of the file I get this.
Upload: ****.vcf
Type: text/x-vcard
Size: 0.287109375 kB
Stored in: /tmp/phpqHOzod
Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in /home2/****/public_html/beta/vcard/mail.php on line 19
Is the temp file already deleted? So I need to move it before reading it? Is there a permission issue?