图片提交到数据库blob和控件大小

时间:2016-01-06 15:30:11

标签: coldfusion

我有一个注册页面,将所有注册值提交到MS SQL数据库。我试图控制更新到数据库的图像的大小为width = 125 height = 125。有没有办法在提交到数据库之前控制它?

这也是将其提交到数据库的最新方式吗?(最近我能找到的是2011年)

FORM

<form class="m-t" role="form" action="cfm/register_process.cfm" method="post" enctype="multipart/form-data">
            <div class="form-group">
                <input type="text" name="employee_number" class="form-control" placeholder="Employee Number" required="">
            </div>
            <div class="form-group">
                <input type="text" name="firstname" class="form-control" placeholder="First Name" required="">
            </div>
            <div class="form-group">
                <input type="text" name="lastname" class="form-control" placeholder="Last Name" required="">
            </div>
            <div class="form-group">
                <input type="text" name="department" class="form-control" placeholder="Department" required="">
            </div>
            <div class="form-group">
                <input type="text" name="position" class="form-control" placeholder="Position" required="">
            </div>
            <div class="form-group">
                <input type="email" name="email" class="form-control" placeholder="Email" required="">
            </div>
            <div class="form-group">
                <input type="text" name="phone_extension" class="form-control" placeholder="Extension" required="">
            </div>
            <div class="form-group">
                <input type="text" name="user_name" class="form-control" placeholder="User ID" required="">
            </div>
            <div class="form-group">
                <input type="password" name="user_pass" class="form-control" placeholder="Password" required="">
            </div>
            <div class="input-group">
                <span class="input-group-btn">
                    <span class="btn btn-primary btn-file">
                    Select image
                    <input type="file" name="filefieldname" id="filefieldname" multiple />
                    </span>
                 </span>
                 <input id="filename" class="form-control" type="text"/>
                 <span class="input-group-btn">
                 <span class="btn btn-primary cleared">Reset</span>
                 </span>
            </div>
            <div class="form-group">
                    <div class="checkbox i-checks"><label> <input type="checkbox"><i></i> Agree the terms and policy </label></div>
            </div>
            <button type="submit" class="btn btn-primary block full-width m-b">Register</button>

            <p class="text-muted text-center"><small>Already have an account?</small></p>
            <a class="btn btn-sm btn-white btn-block" href="login.html">Login</a>
        </form>

然后表单调用register_process.cfm并提交到数据库

    <cffile action="readbinary" file="#form.filefieldname#" variable="bin_filedata">

<cfquery datasource="test" name="UserRegistration">
 INSERT INTO dbo.Users (employee_number, user_name, user_pass, firstname, lastname, position, email, phone_extension, department, picture)
 VALUES (
   , <cfqueryparam value='#form.employee_number#' cfsqltype='cf_sql_varchar' />
   , <cfqueryparam value='#form.user_name#' cfsqltype='cf_sql_varchar' />
   , <cfqueryparam value='#form.user_pass#' cfsqltype='cf_sql_varchar' />
   , <cfqueryparam value='#form.firstname#' cfsqltype='cf_sql_varchar' />
   , <cfqueryparam value='#form.lastname#' cfsqltype='cf_sql_varchar' />
   , <cfqueryparam value='#form.position#' cfsqltype='cf_sql_varchar' />
   , <cfqueryparam value='#form.email#' cfsqltype='cf_sql_varchar' />
   , <cfqueryparam value='#form.phone_extension#' cfsqltype='cf_sql_varchar' />
   , <cfqueryparam value='#form.department#' cfsqltype='cf_sql_varchar' />
   , <cfqueryparam value='#bin_filedata#' cfsqltype='cf_sql_blob' />
 )
</cfquery>

<script>  
    self.location="../login.html"; 
</script>

enter image description here
不幸的是,当我尝试提交这个时,我只得到一个全白屏幕并且它不会更新数据库。我假设我做错了。

0 个答案:

没有答案