Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6081743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:12:36+00:00 2026-05-23T11:12:36+00:00

When I run this code, and $testpage is an alphameric string, it is uploaded

  • 0

When I run this code, and $testpage is an alphameric string, it is uploaded perfectly. However, when $testpage is defined using file_get_contents(…), it does not upload at all.

<?
...
...

mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die("Unable to select database");


$testpage = file_get_contents('http://us3.php.net/manual/en/function.file-get-contents.php');

$testpage = mysql_real_escape_string($testpage);
mysql_query("INSERT INTO theTable(Description,Document) VALUES('PHP Webpage test','$testpage')");
mysql_close;   
?> 

I understood from the PHP docs that file_get_contents(…) was the preferred way to convert files into a string that could be stored in a binary field. I am aware that there are some more security issues that I will have to deal with but first I just want to be able to do the raw upload and proceed from there. Is there any reason why this should not work and if so, what is the best way to do this? Or am I just missing something?

Thanks!

R

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:12:37+00:00Added an answer on May 23, 2026 at 11:12 am

    You need to properly escape the string.

    $testpage = file_get_contents(..);
    $testpage = mysql_real_escape_string($testpage);
    
    mysql_query("INSERT INTO theTable(Description,Document) VALUES('PHP Webpage test','$testpage')");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I run this code the selected item is not visible. I've already tried
I run this code: graphic.addAnimation("standart",new int[] {0,1},1.0,true); which calls the graphic.addAnimation(String,int[],float,boolean) Method: public void
Why run this code and print whole string? #include <stdio.h> void main() { int
Why does this code run differently in CakePHP vs. a normal PHP file? <?php
I can run this code in Android app (using PhoneGap adn jQuery Mobile) but
mvn clean deploy -P PROD What does this code do? mvn jetty:run I have
I have a trouble with QTreeView . When I run this code ui->treeView does
When I run this code in iPhone simulator ,I can not delete record from
I am trying to run this code in android using eclips IDE. int maxrow=0;
I run this code: public class User { public static void main(String args[]) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.