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

  • Home
  • SEARCH
  • 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 8441325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:32:27+00:00 2026-06-10T08:32:27+00:00

I have an application where a user is allowed to save some text data

  • 0

I have an application where a user is allowed to save some text data into a MYSQL database through a web interface. In addition, they can also attach a file to this text and I save this into a blob field. The file types that get attached are simple .txt files.

I am able to save this data into the database but I am having trouble retrieving it. This is what I am doing to retrieve it right now:

//Events that take place when trying to retreive an attached file
function getFile(rowid){

    //Make an AJAX Request to fetch the file
    $.ajax({
        type: 'get',
        url: 'point-of-contact.php',
        data: 'page=attachment&row='+rowid,
        dataType: 'text',
        success: function(data) {
                console.log (data);
        }
    });
}

The AJAX request above leads to the following PHP code:

$attachments = $poc -> getPOC($_GET['row']);
header('Content-type: text/plain');
echo $attachments;

The problem I face is that when I console log the data received from the AJAX request I get this:

enter image description here

How do I go about getting the data in simple text format?

Could it be that the way I am uploading the file to the database is incorrect? This is how the file is uploaded to the DB:

    //File upload code
    var fileInput = document.getElementById('upload');
    var file = fileInput.files[0];

    //Hide the save button
    $("#save-button-1").hide(); 

    //Make the AJAX request
    $.ajax({
        type: 'post',
        url: 'point-of-contact.php?page=add',
        data: 'point_of_contact=' + $("#textarea1").val() + '&point_of_contact_attachment=' + file,
        success: function(data) {
            $('#done-1').show();
            setTimeout(function() {
                $('#done-1').fadeOut();
            }, 2500);
                $('.loader').fadeOut();
        }
    });
  • 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-06-10T08:32:28+00:00Added an answer on June 10, 2026 at 8:32 am

    There is problem in your upload section. The line

    var file = fileInput.files[0];
    

    assignes file object into file variable. Later, when you add it to

    "point_of_contact_attachment="
    

    it gets converted to string. So you will have

    “point_of_contact_attachment=[object file]”

    And that is it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application which needs to do some checking before user is
I have created a web part in asp.net application and allowed user to change
I have an application using Spring with Hibernate on a MySQL database. For some
I have an application where the user can write up some questions and add
I have a rails application with User and Machine data models, as well as
Is it good idea to have application engine written in c++ and user interface
I have an application I am developing where the user is allowed to email
I am looking into if it is possible to have a web application access
I have some rails application with MongoDB, Mongoid mapper and devise. Аuthorized user can
I have a web-application where the users can be sent directly to some specific

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.