javascript – When sending formdata as data with ajax an empty array is sent

I'm trying to send data, including a file (it's an image), but when testing what ajax sends, it prints the keys to an empty array ({}), I'm using nodejs with jswebtokenizer, here's my code:

function publicar(){
var nombre_archivo =  document.getElementById('imagen').files(0).name;
var file = document.getElementById('imagen').files(0)
var descripcion = document.getElementById("desc").value
var id = localStorage.getItem("Id")
var categoria = document.getElementById("category").innerHTML
let formdata = new FormData()
formdata.append('imagen',file)
formdata.append('nombre_arch',nombre)
formdata.append('descripcion',descripcion)
formdata.append('categoria',categoria)
formdata.append('id',id)

    var xmlhttp = new XMLHttpRequest()

    xmlhttp.open('POST',url+"/informacion",true)
    xmlhttp.setRequestHeader('Content-Type', 'multipart/form-data'); 
    xmlhttp.setRequestHeader('Authorization', 'Bearer ' + localStorage.getItem("Id"));
    xmlhttp.send(JSON.stringify(formdata))
    xmlhttp.onreadystatechange = function(){
        if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
            alert("se subio correctamente")

        }



}

I print the result on the server

principal.post("/informacion",(req,res)=>{
console.log(req.body)

})

Empty the garbage slowly on the external hard drive?

macOS Catalina.
Emptying garbage in the internal SSD is normal, but very slow in the external HDD (USB 3.0, 5400 rpm).

I just received 3 empty MMS fixed line texts

I have a Samsung Galaxy S7. Yesterday, about the same time, I received three empty MMS text messages, supposedly all of different landline numbers. The numbers were in my contact list. How can this happen?

Thank you!

WordPress: how to programmatically set the price of a product, a brief description and a featured image? The cart must be empty all the time

I need to dynamically "preconfigure" an existing WooCommerce product, which is initially "blank." And by "blank" I mean:

  • price: 0.00 (currency symbol)
  • Short description: empty rope
  • main photo: any

The "blank" product has to be pre-configured programmatically with personalized data, according to the previous list, based on a visitor's choices, and then be ready to be added to the shopping cart when the visitor decides at a time later. during your browsing session throughout the website.

For example, according to the previous choices of the visitor, said preconfigured product would have the following:

  • Price: 1290.00 (currency symbol)
  • Brief description: "This closet has 4 doors, blah, blah, blah …"
  • Featured image: dynamically generated

An important aspect of all this is that the cart must be empty all the time, or at least until the visitor decides at a later time to add the "preconfigured" product to the cart, that is, the product could not be already in the cart before "preconfiguring".

So here is a possible pseudo code representation of this process:

  1. Select WooCommerce product with identification X and Z
  2. WooCommerce sets product with id X and Z price to a B C
  3. WooCommerce sets product with id X and Z Short description to "lorem ipsum"
  4. WooCommerce sets product with id X and Z main photo to image identification def

Any ideas on how I could achieve this?

Thank you very much!

bash – CD behavior with an empty string argument

I have a small command that goes to the root of the git repository:

cg() {
  cd "$(git rev-parse --show-toplevel)"
}

When it is not inside the git repository it runs cd "" which, I thought, is not supposed to do anything.

However after configuring also $CDPATH Now this behavior seems to have changed. Instead cd "" he takes me to $CDPATH.

My question: is it a small mistake or a documented / expected behavior?

Is it okay to use an empty hashtag URL for web accessibility?

Many times the drop-down menus are structured with empty hashtag URLs in anchor tags, like this:


The drop-down menu is displayed when you mouse over or click. An example of this is the desktop navigation menu at adobe.com

Is this hashtag URL harmful to screen reader users? Semantically, this should probably be a

Missing operating system, empty partition was enabled by me as an error

I made a new partition that was empty, but when I restarted my laptop for the installation of new windows changing from win 10 to 7, the screen I got was "missing the operating system", my laptop does not boot from the CD ROM, so how to install a new window.
How do I make it possible to change my partition where I installed Windows that was Windows 7 just by boot?

magento2 – Magento 2 Empty cart using Memcache

I am using Magento2.2.2 with memcache. Facing a problem with memcache.
Without memcache, adding the cart works fine and the cart page shows the items added.
if you enable memcache and config.php configured after clicking addtocart that shows the success message item added to the cart but the cart page is empty.

My env.php settings

array (
'save' => 'memcached',
'save_path' => 'localhost:11211',

),

any solution

nginx: REMOTE_USER is empty in the django after redirecting

It seems to me that I don't understand the REMOTE_USER variable very well.
I have three instances based on different hosts:
nginx, django_auth_server, django_app_server.
I am trying to implement "single sign-on": the user logs into the django_auth_server server through nginx, is redirected to the django_app_server server and continues browsing without authentication.
In my case, after redirection to the root folder (from & # 39; / login & # 39; to & # 39; / & # 39;), the REMOTE_USER variable is empty.
But it exists in the request headers:

Content-Type: text/html; charset=utf-8
Location: /
REMOTE_USER: alfabeta
X-Frame-Options: SAMEORIGIN
Vary: Cookie
Content-Length: 0
Set-Cookie:  csrftoken=...
Set-Cookie:  sessionid=...

Authorization view code (djangoauth instance):

        if user is not None:
            login(request, user)
            r = redirect('/')
            r('REMOTE_USER') = username
            return r

I am not sure if it is correct to set the variable in this way.

part of nginx configuration

server {
  listen 8080 default_server; 
  server_name localhost;
  charset     utf8;
  autoindex   off;

  underscores_in_headers on;
  proxy_pass_request_headers on;
  ...
  location / {
    include /etc/nginx/uwsgi_params;
    uwsgi_pass uwsgiapp;
    uwsgi_read_timeout 300;

    uwsgi_param Host $host;
    uwsgi_param X-Real-IP $remote_addr;
    uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
    uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;

  }

  location =/login/ {
    include /etc/nginx/uwsgi_params;
    uwsgi_pass uwsgiauth;
    uwsgi_read_timeout 300;

    uwsgi_param Host $host;
    uwsgi_param X-Real-IP $remote_addr;
    uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
    uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;

    uwsgi_param REMOTE_USER $remote_user;
  }

How to pass the variable to the application server?

Why is the file "sudo vim /etc/my.cnf" empty?

I want to edit some of the InnoDB variables, I go to the .my.cnf found in home / .my.cnf. I found the file simply empty. And when I check SHOW VARIABLES in MySQL it gives me all the variables and their values. Why is the file empty and how can I edit the necessary variables?